DicomServer/Desktop/Worklist SCP/WorklistServer.cs

52 lines
1.4 KiB
C#
Raw Normal View History

2024-12-13 10:06:20 +08:00
// 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<WorklistItem> CurrentWorklistItems { get; private set; }
public static void Start(int port, string aet)
{
AETitle = aet;
_server = DicomServerFactory.Create<WorklistService>(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();
}
}
}