using LampInspectionMachine.Core; using LampInspectionMachine.Log4xml; using LampInspectionMachine.Model; using LampInspectionMachine.Views; using log4net.Config; using Prism.Ioc; using Prism.Unity; using System.ComponentModel; using System.IO; using System.Threading; using System.Windows; namespace LampInspectionMachine { /// /// App.xaml 的交互逻辑 /// public partial class App : PrismApplication { protected override Window CreateShell() { //XmlConfigurator.Configure(new FileInfo("Log4xml/log4net.config")); LogHelper.Info("程序启动"); return Container.Resolve(); } protected override void RegisterTypes(IContainerRegistry containerRegistry) { containerRegistry.RegisterForNavigation("RoleLoginView"); containerRegistry.RegisterForNavigation("MenuView"); containerRegistry.RegisterForNavigation("ProductView"); containerRegistry.RegisterForNavigation("SettingView"); containerRegistry.RegisterForNavigation("WorkRunView"); containerRegistry.RegisterForNavigation("VisionProView"); containerRegistry.RegisterForNavigation("VisionProView"); containerRegistry.RegisterSingleton(); containerRegistry.RegisterSingleton(); containerRegistry.RegisterForNavigation("CameraView"); } private static System.Threading.Mutex mutex; protected override void OnStartup(StartupEventArgs e) { //var view = new LoginView(); //if (!(bool)view.ShowDialog()) //{ // this.Shutdown(); //} mutex = new System.Threading.Mutex(true, "OnlyRun_CRNS"); if (mutex.WaitOne(0, false)) { base.OnStartup(e); } else { MessageBox.Show("程序已经在运行!", "提示"); this.Shutdown(); } } } }