12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- // Copyright (c) 2012-2020 fo-dicom contributors.
- // Licensed under the Microsoft Public License (MS-PL).
- using Dicom.Network;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading;
- using Worklist_SCP.Model;
- namespace Worklist_SCP
- {
- public class WorklistServer
- {
- private static IDicomServer _server;
- //private static Timer _itemsLoaderTimer;
- protected WorklistServer()
- {
- }
- public static string AETitle { get; set; }
- //public static IWorklistItemsSource CreateItemsSourceService => new WorklistItemsProvider();
- public static List<WorklistItem> CurrentWorklistItems { get; private set; }
- public static void Start(int port, string aet)
- {
- AETitle = aet;
-
- NetworkManager.SetImplementation(new DesktopNetworkManager());
- Dicom.IO.IOManager.SetImplementation(ZskkIOManager.Instance);
- //Dicom.IO.IOManager.SetImplementation(new Dicom.IO.DesktopIOManager());
- _server = DicomServer.Create<WorklistService>("0.0.0.0", port);
- // every 30 seconds the worklist source is queried and the current list of items is cached in _currentWorklistItems
- //_itemsLoaderTimer = new Timer((state) =>
- //{
- // var newWorklistItems = CreateItemsSourceService.GetAllCurrentWorklistItems();
- // CurrentWorklistItems = newWorklistItems;
- //}, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
- }
- public static void Start(string ipAdress ,int port, string aet)
- {
- AETitle = aet;
- NetworkManager.SetImplementation(new DesktopNetworkManager());
- //Dicom.IO.IOManager.SetImplementation(Dicom.IO.DesktopIOManager.Instance);
- Dicom.IO.IOManager.SetImplementation(ZskkIOManager.Instance);
- _server = DicomServer.Create<WorklistService>(ipAdress, port);
- // every 30 seconds the worklist source is queried and the current list of items is cached in _currentWorklistItems
- //_itemsLoaderTimer = new Timer((state) =>
- //{
- // var newWorklistItems = CreateItemsSourceService.GetAllCurrentWorklistItems();
- // CurrentWorklistItems = newWorklistItems;
- //}, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
- }
- public static void Stop()
- {
- //_itemsLoaderTimer?.Dispose();
- _server.Dispose();
- }
- }
- }
|