// 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 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("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(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(); } } }