If our standalone app were just a downloaded .exe file (i.e. deployed using windows installer), it would be fairly simple to have a running instance launch a second instance using System.Diagnostics.Process.Start
. Unfortunately, our WPF application is deployed VIA ClickOnce, so there's no local file system path to it as far as I know.
How can I launch a second instance of a running ClickOnce app? (And pass it command line parameters if possible.)
You will need to create an instance of a new window like so. var window2 = new Window2(); Once you have the instance you can use the Show() or ShowDialog() method depending on what you want to do.
Window is the root control that must be used to hold/host other controls (e.g. Button) as container. Page is a control which can be hosted in other container controls like NavigationWindow or Frame. Page control has its own goal to serve like other controls (e.g. Button). Page is to create browser like applications.
Entry point is App. xaml.
When a Window is created at run-time using the Window object, it is not visible by default. To make it visible, we can use Show or ShowDialog method. Show method of Window class is responsible for displaying a window.
You're incorrect: there is a local path, under your local Application Data folder. Alternatively, you can relaunch the application using the Uri. In short, you should be able to work out the launch path for your application (maybe using Environment.CommandLine
or System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
) as you would for a regular application, and use that.
well, there IS a local filesystem path when you deploy it via clickonce. Try
yourWindow.GetType().Assembly.Location
-> this will give you the full path to your assembly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With