123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // 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.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(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(new Dicom.IO.DesktopIOManager());
- _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();
- }
- }
- }
|