// Copyright (c) 2012-2021 fo-dicom contributors. // Licensed under the Microsoft Public License (MS-PL). using FellowOakDicom.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; _server = DicomServerFactory.Create(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("wk2"); // CurrentWorklistItems = newWorklistItems; //}, null, TimeSpan.Zero, TimeSpan.FromSeconds(30)); } public static void Stop() { _itemsLoaderTimer?.Dispose(); _server.Dispose(); } } }