In my application I have wrote this sub for restart my programm. This code is ok.
Sub Restart
     'For restart application many times
     Application.Current.Shutdown()
     System.Diagnostics.Process.Start(Application.ResourceAssembly.Location)
End Sub
After a few days, I've added this code to check the program is already running. (and this code is ok)
Sub IsRunning
   'Check if it's already running
   If (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1) Then
         Msg = "Application is running"
         MessageBox.Show(Msg, "Attention", MessageBoxButton.OK, MessageBoxImage.Error)
         Application.Current.Shutdown()
  End If
End Sub
Now, what's the issue ? If I try to restart application, I recive the message "Application is running" and I can't do that !
How solve this issue ?
Many thanks
 
     
    