Rss Feed
Tweeter button
Facebook button
Technorati button
Reddit button
Myspace button
Linkedin button
Webonews button
Delicious button
Digg button
Flickr button
Stumbleupon button
Newsvine button
logo

Writing a single instance application in WPF

logo

We’ll go through some solutions to the problem of building a single instance application in WPF, like Firefox. This means running your application again will not create a new instance but instead just pass any arguments to the current instance.

 

WPF – Writing a Single Instance Application

By default, it comes up with two main items in the solution – "Window1.xaml" (which I renamed to ExampleWindow.xaml") and "App.xaml". Both of these also have their respective code behind files. So first off, do something you have probably never done before – delete "App.xaml" and "App.xaml.cs". We won’t be needing them, because we will be doing our own Application creation.

Now create a new class (I called it "ExampleApplcation"). This will be our application. The two main pieces of logic that this class needs to have are for showing the main window and for processing command line arguments. The first piece will only happen once – the initial application start up. The second, however, will happen every time a user tries to run the app (and we will see how that works in a moment).

Read more: http://www.switchonthecode.com/tutorials/wpf-writing-a-single-instance-application

 

Single Instance Application Manager

Some .Net applications are required to run as single instance process (at startup, each process “ensures” that he’s unique). This requirement may come from licensing issues, technical and/or other reasons. Quick search in Google will provide a variety of solutions, most of them are based on WindowsFormsApplicationBase object from VB.Net, usage of Mutex object and other techniques. I don’t like mixing VB with C#, and also Win-Forms solution isn’t “pure” enough for WPF applications. So I wrote my version of “Single Instance Manager”…

This post will provide short description about this small project and links to download the sources.

How to Create Single Instance Application for WPF, Win-Forms and Console Applications

The manager uses well-known ThreadPool object with WaitEventHandle object and IpcClientChannel to pass messages (objects) between processes (.Net Remoting).


image_thumb_2F512F9C

http://blogs.microsoft.co.il/blogs/maxim/archive/2010/02/13/single-instance-application-manager.aspx

 

Single Instance Codeplex Project

Project Description
It is made by means of Threads synchronization model.
I used EventWaitHandle Class.

http://wpfsingleinstance.codeplex.com/releases/view/20316

 

Other Useful Links

http://rrelyea.spaces.live.com/blog/cns!167AD7A5AB58D5FE!1834.entry – More Links

http://msdn2.microsoft.com/en-us/library/ms771662.aspx – MSDN

26 Responses to “Writing a single instance application in WPF”

  1. RALPH says:


    Pillspot.org. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. No prescription pills. Order drugs online

    Buy:Human Growth Hormone.Prednisolone.Arimidex.Valtrex.Petcam (Metacam) Oral Suspension.Actos.100% Pure Okinawan Coral Calcium.Zyban.Zovirax.Synthroid.Prevacid.Retin-A.Accutane.Mega Hoodia.Lumigan.Nexium….

  2. JARED says:


    Medicamentspot.com. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. No prescription drugs. Order drugs online

    Buy:Female Pink Viagra.Nymphomax.Prozac.Seroquel.Zetia.Female Cialis.Lipitor.Ventolin.Amoxicillin.Lasix.Acomplia.Wellbutrin SR.Advair.SleepWell.Buspar.Lipothin.Cozaar.Zocor.Aricept.Benicar….

  3. KURT says:


    CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. Low price pills. Buy pills online

    Buy:Super Active ED Pack.Maxaman.Viagra Professional.Cialis Super Active+.Viagra.Levitra.VPXL.Cialis.Propecia.Soma.Cialis Soft Tabs.Viagra Super Force.Zithromax.Cialis Professional.Viagra Soft Tabs.Viagra Super Active+.Tramadol….

  4. KEVIN says:


    CheapTabletsOnline.Com. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. High quality drugs. Order drugs online

    Buy:Human Growth Hormone.Accutane.Retin-A.Prednisolone.100% Pure Okinawan Coral Calcium.Synthroid.Zovirax.Valtrex.Mega Hoodia.Lumigan.Nexium.Prevacid.Petcam (Metacam) Oral Suspension.Actos.Zyban.Arimidex….

  5. BILLY says:


    CheapTabletsOnline.com. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. High quality drugs. Buy pills online

    Buy:Actos.Prednisolone.Petcam (Metacam) Oral Suspension.Zovirax.Human Growth Hormone.Nexium.100% Pure Okinawan Coral Calcium.Lumigan.Arimidex.Retin-A.Accutane.Mega Hoodia.Zyban.Synthroid.Prevacid.Valtrex….

  6. knickers says:

    knickers http://vlm.gef.11i.co : knickers…

    knickers…

  7. CARLOS says:

    ████████►BUY CIALIS◀████████…

    ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲…

  8. LONNIE says:

    abilify side effects in children

    Buydrugs without prescription…

  9. TODD says:

    buy pure acai berry

    Buyno prescription…

  10. TERRANCE says:

    Abana

    Buywithout prescription…

  11. WALTER says:

    Abilify@official.site” rel=”nofollow”>…

    Buyno prescription…

  12. EUGENE says:

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  13. CLAUDE says:

    Allegra@official.site” rel=”nofollow”>…

    Buygeneric pills…

  14. FERNANDO says:

    Amoxicillin@official.site” rel=”nofollow”>…

    Buyno prescription…

  15. KELLY says:

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  16. LARRY says:

    ..

    Buygeneric drugs…

  17. GREGORY says:

    Azor@official.site” rel=”nofollow”>…

    Buygeneric pills…

  18. ALBERTO says:

    Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  19. RICK says:

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  20. RAYMOND says:

    Cozaar@official.site” rel=”nofollow”>..

    Buynow it…

  21. RICK says:

    celexa@canada.now” rel=”nofollow”>.

    Buynow…

  22. DARRELL says:

    generic@viagra.sildenafil.paypal.no.prescription” rel=”nofollow”>…

    Buygeneric meds…

  23. GUY says:

    abilify@and.sleep.issues” rel=”nofollow”>.

    Buyno prescription…

  24. JON says:

    < a href="http://my.gardenguides.com/members/buy-Tramadol? buy@tramadol.best.price.online

    Buyit now…

Leave a Reply

You must be logged in to post a comment.

logo
logo
Powered by Wordpress