1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- namespace AIRS
- {
- /// <summary>
- /// App.xaml 的交互逻辑
- /// </summary>
- public partial class App : Application
- {
- 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, "AIRS", out ret);
- if (!ret)
- {
- MessageBox.Show("已有一个程序实例正在运行","提示",MessageBoxButton.OK,MessageBoxImage.Error);
- Environment.Exit(0);
- }
- }
- }
- }
|