We have used 
http://wpfinstanceawareapp.codeplex.com/SourceControl/changeset/view/53538#530407
 in our WPF application, it worked pretty well. But I recall having to change 
something in the code... forget what though :P

The advantage of this is it actually will use wcf named pipes to pass the 
arguments the second instance was started with to the first instance of the 
app. It seems to be a pretty nice solution.

Cheers,
Jake

From: [email protected] [mailto:[email protected]] On 
Behalf Of Ian Thomas
Sent: Friday, 30 December 2011 5:47 PM
To: 'ozDotNet'
Subject: RE: Switching between single- and multiple-instance (WinForms)


Arjang

What is the recommended way in WPF to ensure single instance apps?

This 
suggests<http://social.msdn.microsoft.com/Forums/en/wpf/thread/f26de29b-3381-440e-9054-59d32e4a0c92>
 (Jan 2011) that WPF does not have "a native way" of creating a single instance 
application - and that "This is a major fail" (of WPF design). Really?

In that link discussion, the code used references the Microsoft.VisualBasic 
assembly and (SingleInstanceManager :) WindowsFormsApplicationBase. (Actually, 
it seems simple enough to me, but the discussion is about application crashes 
for some indefinable reasons).

Here<http://blogs.microsoft.co.il/blogs/arik/archive/2010/05/28/wpf-single-instance-application.aspx>
 is another suggested way to do it (blog, from May 2010). Actually, this 
approach has been described for a few years - though the blog suggests 
Microsoft will/has released some "WPF reference samples" using it. Mutex, 
Remoting (sounds familiar?)

Actually, I will use a different approach where the single application spawns 
separate threaded processes, which means the question I asked is theoretical 
rather than practical - but for my own education I'd still like to research 
different approaches.

________________________________

Ian Thomas
Victoria Park, Western Australia



-----Original Message-----
From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
 On Behalf Of Arjang Assadi
Sent: Thursday, December 29, 2011 10:25 PM
To: ozDotNet
Subject: Re: Switching between single- and multiple-instance (WinForms)



WPF or WinForms?





On 29 December 2011 20:47, Ian Thomas 
<[email protected]<mailto:[email protected]>> wrote:

> Visual Basic projects can be very easily made single instance (Make Single

> Instance Application property for the project), but I'd like a simple way to

> change single instance behaviour to multiple-instance (in the same way that

> many text editors allow it as a configuration - eg, TextPad).

>

> What is recommended? (either language)

>

> ________________________________

>

> Ian Thomas

> Victoria Park, Western Australia

Reply via email to