Program.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (c) 2012-2020 fo-dicom contributors.
  2. // Licensed under the Microsoft Public License (MS-PL).
  3. using Dicom.Log;
  4. using System;
  5. using System.Configuration;
  6. using System.Threading;
  7. namespace Worklist_SCP
  8. {
  9. public class Program
  10. {
  11. protected Program()
  12. {
  13. }
  14. static void Main(string[] args)
  15. {
  16. // Initialize log manager.
  17. LogManager.SetImplementation(ConsoleLogManager.Instance);
  18. var configIpAddress = ConfigurationManager.AppSettings["IpAddress"];
  19. var configPort = ConfigurationManager.AppSettings["Port"];
  20. var configAETitle = ConfigurationManager.AppSettings["AETitle"];
  21. Console.WriteLine($"Starting QR SCP server with AET: {configAETitle} on ipAdress {configIpAddress} port {configPort}");
  22. WorklistServer.Start(configIpAddress, int.Parse(configPort), configAETitle);
  23. Console.WriteLine("Press any key to stop the service");
  24. //Console.Read();
  25. //while (true)
  26. //{
  27. // // Console.WriteLine("Stopping QR service");
  28. //}
  29. //WorklistServer.Stop();
  30. for (; ; )
  31. {
  32. try
  33. {
  34. Thread.Sleep(10000);
  35. }
  36. catch (ThreadInterruptedException e)
  37. {
  38. ConsoleLogger.Instance.Error("捕获异常{0}", e.Message);
  39. }
  40. }
  41. }
  42. }
  43. }