How to check programmatically whether my WPF app is working or not right now?, Like App.PrevInstance in VB. Please suggest me a simple method, i am beginner.
Here my code,
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var runningProcessByName = Process.GetProcessesByName("TCLCGFP");
if (runningProcessByName.Length == 0)
{
//Process.Start("TCLCGFP.exe");
new TraacsClcProcess();
}
else
{
MessageBox.Show("Application is already Running.","TCLCGFP",MessageBoxButton.OK,MessageBoxImage.Information);
}
Environment.Exit(0);
}
It is always showing Application is already Running :P