Results 1 to 6 of 6

Thread: WPF Application.Restart Two Instances / Single Instance App

  1. #1

    Thread Starter
    Addicted Member cellus205's Avatar
    Join Date
    Dec 2010
    Location
    San Antonio, TX
    Posts
    237

    WPF Application.Restart Two Instances / Single Instance App

    Hey guys, when I run Application.Restart after running my Update Form, in the Task Manager my executable is running twice. The application seems to close, but it seems to still run in the background.

    Also, on a seperate issue, Is there a Simple way to implement my application as a "Single Instance" application, like in Windows Forms?

    Thanks

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: WPF Application.Restart Two Instances / Single Instance App

    Cellus205, we actually have a WPF section that this should probably be in. Don't worry though, I've alerted the mods and if appropriate, they'll move it.

    As for your restart issue, that is a bit odd. Have you initiated a secondary background thread prior to restarting?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Addicted Member cellus205's Avatar
    Join Date
    Dec 2010
    Location
    San Antonio, TX
    Posts
    237

    Re: WPF Application.Restart Two Instances / Single Instance App

    Ah ok, thanks I wasn't aware. But no, I'm not running any background threads in this app.

  4. #4
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: WPF Application.Restart Two Instances / Single Instance App

    Quote Originally Posted by cellus205 View Post
    Ah ok, thanks I wasn't aware. But no, I'm not running any background threads in this app.
    So, now I'm a bit confused. Can you explain exactly what you're doing and exactly what's involved? Any code examples will help greatly. Please be as specific as you can.

    I just tried making a trial WPF app, to test Application.Restart, but that method does not exist in WPF. So, what's going on here? Are you importing windows form's namespaces? Or is it a second app?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  5. #5

    Thread Starter
    Addicted Member cellus205's Avatar
    Join Date
    Dec 2010
    Location
    San Antonio, TX
    Posts
    237

    Re: WPF Application.Restart Two Instances / Single Instance App

    Yep, Im importing Windows Forms, then calling my AutoUpdate class to update the program, and after it completes, it runs the Application.Restart. Here's how Im calling it

    Code:
      Dim myAutoUpdate As New AutoUpdate
            myAutoUpdate.tsForm = Me
            If myAutoUpdate.AutoUpdate(CommandLine, RemotePath) = True Then
                Forms.Application.Restart()
            End If

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: WPF Application.Restart Two Instances / Single Instance App

    Thread moved from the 'VB.Net' forum to the 'WPF, ..' forum

    (thanks for letting us know weirddemon )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width