App.xaml.cs 971 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using DeviceCenter.model;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Configuration;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. namespace DeviceCenter
  11. {
  12. /// <summary>
  13. /// App.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class App : Application
  16. {
  17. System.Threading.Mutex mutex;
  18. public App()
  19. {
  20. this.Startup += new StartupEventHandler(App_Startup);
  21. }
  22. void App_Startup(object sender, StartupEventArgs e)
  23. {
  24. bool ret;
  25. mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);
  26. if (!ret)
  27. {
  28. Environment.Exit(0);
  29. }
  30. Config config = new Config();
  31. string json = JsonConvert.SerializeObject(config, Formatting.Indented);
  32. Console.WriteLine(json);
  33. }
  34. }
  35. }