문제

the WPF app I have has been redesigned to use tabs and be single instance. The new requirement is now that when launched with command line options and an instance of the app is already running - the already running instance should open a new tab and do some work based on the cmdline options.

the single instance is no prob - but how to pass the cmd line args from the just started instance the the already running?

thanks for any hints!

도움이 되었습니까?

해결책

I would approach this with either a sockets solution or just have the new instance write the command line args to a file which is checked and then flushed by the existing instance.

다른 팁

Take a look at WindowsFormsApplicationBase, it has all the support for that scenario built-in.

Unfortunately it is meant for WinForms, but a quick spin through Reflector should get you all the code you need for a WPF version.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top