App.xaml.cs 841 B

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