Exemplo n.º 1
0
        public async Task Action(TransmissionInfo info)
        {
            Console.WriteLine($"-- Start transmission {info.TaskId}");
            await _transmission(info);

            OneTaskCompleted(info.TaskId);
        }
Exemplo n.º 2
0
        static async Task SendTask(TransmissionInfo info)
        {
            try
            {
                var client = new DicomClient();

                foreach (var file in info.Folder.GetFiles("*.*", SearchOption.AllDirectories))
                {
                    DicomCStoreRequest request = new DicomCStoreRequest(file.FullName);
                    request.OnResponseReceived += (req, rsp) =>
                    {
                        //             Console.WriteLine(rsp.Status + $"{req.MessageID}, {Thread.CurrentThread.ManagedThreadId}");
                    };
                    client.AddRequest(request);
                }

                var task1 = AbortTask(client, info.Token, info.TaskId);

                var node  = PacsNode.Strongs;
                var task2 = client.SendAsync(node.Host, node.Port, false, "SCU", node.AET);

                await Task.WhenAny(task1, task2);

                client.Release();
                Console.WriteLine($"Complete {info.TaskId}");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {info.TaskId} " + ex.Message);
            }
        }
Exemplo n.º 3
0
        public void Add(TransmissionInfo taskA)
        {
            _actionCollection.AddOrUpdate(taskA.TaskId, taskA, (key, oldValue) => taskA);
            var task = Action(taskA);

            if (_actionCollection.Count >= 4)
            {
                _event.Reset();
            }
        }