App.xaml.cs 804 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. namespace UploadClient
  9. {
  10. /// <summary>
  11. /// App.xaml 的交互逻辑
  12. /// </summary>
  13. public partial class App : Application
  14. {
  15. System.Threading.Mutex mutex;
  16. public App()
  17. {
  18. this.Startup += new StartupEventHandler(App_Startup);
  19. }
  20. void App_Startup(object sender, StartupEventArgs e)
  21. {
  22. bool ret;
  23. mutex = new System.Threading.Mutex(true, "UploadClient", out ret);
  24. if (!ret)
  25. {
  26. MessageBox.Show("部署工具只能开启一个");
  27. Environment.Exit(0);
  28. }
  29. }
  30. }
  31. }