From 81f77ea59fe6ca333572215ec8ca5886273cb59b Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 13 Apr 2021 11:10:20 -0700 Subject: [PATCH] Single Instance app changes. --- .gitignore | 7 ++++++- BodyshopUploader/App.xaml.cs | 11 +++++++++++ BodyshopUploader/Properties/AssemblyInfo.cs | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bd9b4d5..b7e6124 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.userosscache *.sln.docstates + # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs @@ -345,4 +346,8 @@ healthchecksdb !**/Releases/ !**/Releases/* -!**/Releases/**/* \ No newline at end of file +!**/Releases/**/* + +*.exe +*.nupkg +*.msi \ No newline at end of file diff --git a/BodyshopUploader/App.xaml.cs b/BodyshopUploader/App.xaml.cs index 8e80f61..3a7440a 100644 --- a/BodyshopUploader/App.xaml.cs +++ b/BodyshopUploader/App.xaml.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Configuration; using System.Data; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -18,6 +19,16 @@ namespace BodyshopPartner { //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-MX"); //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-CA"); + + Process proc = Process.GetCurrentProcess(); + int count = Process.GetProcesses().Where(p => + p.ProcessName == proc.ProcessName).Count(); + + if (count > 1) + { + MessageBox.Show("ImEX Online Partner is already running."); + App.Current.Shutdown(); + } } private void Application_Exit(object sender, ExitEventArgs e) diff --git a/BodyshopUploader/Properties/AssemblyInfo.cs b/BodyshopUploader/Properties/AssemblyInfo.cs index 52543a1..42d897d 100644 --- a/BodyshopUploader/Properties/AssemblyInfo.cs +++ b/BodyshopUploader/Properties/AssemblyInfo.cs @@ -51,7 +51,7 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.13.0")] +[assembly: AssemblyVersion("1.0.14.0")] [assembly: AssemblyFileVersion("1.0.0.0")] //Setting Squirrel Aware Version. [assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] \ No newline at end of file