diff --git a/App.xaml.cs b/App.xaml.cs index 6d8abe8..c245e59 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -2,7 +2,11 @@ using System.Collections.Generic; using System.Configuration; using System.Data; +using System.Diagnostics; +using System.IO; using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows; @@ -13,5 +17,29 @@ namespace Audit /// public partial class App : Application { + /// + /// App.xaml 的交互逻辑 + /// + System.Threading.Mutex mutex; + /// + ///检查应用进程,防止重复启动。 + /// + public App() + { + this.Startup += new StartupEventHandler(App_Startup); + } + + void App_Startup(object sender, StartupEventArgs e) + { + bool ret; + mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret); + + if (!ret) + { + MessageBox.Show("SC:审计管理已启动"); + Environment.Exit(0); + } + + } } } diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 3c91687..42f4a8f 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -37,13 +37,13 @@ namespace Audit private void exit(object sender, RoutedEventArgs e) { - Application.Current.Shutdown();//关闭窗口 + Application.Current.Shutdown();//关闭全部窗口 } private void help(object sender, RoutedEventArgs e) { - Windows.help help= new Windows.help(); - help.Show();//实例化并打开帮助窗口 + Windows.help help = new Windows.help(); + help.Show();//实例化并打开帮助窗口 } private void RadioButton_Checked(object sender, RoutedEventArgs e) @@ -52,9 +52,9 @@ namespace Audit if (string.IsNullOrEmpty(button.Content.ToString())) return; switch (button.Content.ToString()) { - case "查询": container.Content = new QueryView(); break; - case "原料": container.Content = new StuffView(); break; - case "统计": container.Content = new StatisticsView(); break; + case "查询": container.Content = new QueryView(); break; + case "原料": container.Content = new StuffView(); break; + case "统计": container.Content = new StatisticsView(); break; default: break; } diff --git a/ViewModel/QueryViewModel.cs b/ViewModel/QueryViewModel.cs index 27ab78d..988e960 100644 --- a/ViewModel/QueryViewModel.cs +++ b/ViewModel/QueryViewModel.cs @@ -31,6 +31,9 @@ namespace Audit.ViewModel RaisePropertyChanged(); } } + /// + /// DyelotsBulkedRecipe + /// public List DyelotsBulkedRecipe { get