public static void Unsubscribe(IWorkItemActivityCallback callback)
 {
     try
     {
         SubscriptionManager<IWorkItemActivityCallback>.Unsubscribe(callback, WorkItemsChanged);
         SubscriptionManager<IWorkItemActivityCallback>.Unsubscribe(callback, StudiesCleared);
     }
     catch (Exception e)
     {
         Platform.Log(LogLevel.Error, e);
         throw;
     }
 }
        public static void Unsubscribe(IWorkItemActivityCallback callback)
        {
            try
            {
                SubscriptionManager <IWorkItemActivityCallback> .Unsubscribe(callback, WorkItemsChanged);

                SubscriptionManager <IWorkItemActivityCallback> .Unsubscribe(callback, StudiesCleared);
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Error, e);
                throw;
            }
        }
Example #3
0
 public WorkItemActivityMonitorServiceType()
 {
     _callback = OperationContext.Current.GetCallbackChannel <IWorkItemActivityCallback>();
 }
Example #4
0
        private void TestActivityMonitorSubscriptions(IWorkItemActivityMonitor monitor, IWorkItemActivityCallback callback)
        {
            ResetCallbackFields();

            var item = new WorkItemData { Type = DicomRetrieveRequest.WorkItemTypeString };
			var items = new List<WorkItemData> { item };
        	var eventType = WorkItemsChangedEventType.Update;
			SubscribeAndPause(monitor, WorkItemChanged1);

			WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 1);
            Assert.AreEqual(1, WorkItemChanged1Count);
            Assert.AreEqual(0, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            SubscribeAndPause(monitor, WorkItemChanged2);
			WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 2);
            Assert.AreEqual(2, WorkItemChanged1Count);
            Assert.AreEqual(1, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            item.Type = DicomSendRequest.WorkItemTypeString;
			callback.WorkItemsChanged(eventType, items);
            Thread.Sleep(100);
            Assert.AreEqual(3, WorkItemChanged1Count);
            Assert.AreEqual(2, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            UnsubscribeAndPause(monitor, WorkItemChanged1);
			callback.WorkItemsChanged(eventType, items);
            Thread.Sleep(100);
            Assert.AreEqual(3, WorkItemChanged1Count);
            Assert.AreEqual(3, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            SubscribeAndPause(monitor, WorkItemChanged1);
            UnsubscribeAndPause(monitor, WorkItemChanged2);
            SubscribeAndPause(monitor, WorkItemChanged3);
			WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 2);
            Assert.AreEqual(4, WorkItemChanged1Count);
            Assert.AreEqual(3, WorkItemChanged2Count);
            Assert.AreEqual(1, WorkItemChanged3Count);

            //TODO (Marmot): Expand to include multiple filters, etc.
        }
Example #5
0
        private void TestActivityMonitorSubscriptions(IWorkItemActivityMonitor monitor, IWorkItemActivityCallback callback)
        {
            ResetCallbackFields();

            var item = new WorkItemData {
                Type = DicomRetrieveRequest.WorkItemTypeString
            };
            var items = new List <WorkItemData> {
                item
            };
            var eventType = WorkItemsChangedEventType.Update;

            SubscribeAndPause(monitor, WorkItemChanged1);

            WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 1);
            Assert.AreEqual(1, WorkItemChanged1Count);
            Assert.AreEqual(0, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            SubscribeAndPause(monitor, WorkItemChanged2);
            WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 2);
            Assert.AreEqual(2, WorkItemChanged1Count);
            Assert.AreEqual(1, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            item.Type = DicomSendRequest.WorkItemTypeString;
            callback.WorkItemsChanged(eventType, items);
            Thread.Sleep(100);
            Assert.AreEqual(3, WorkItemChanged1Count);
            Assert.AreEqual(2, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            UnsubscribeAndPause(monitor, WorkItemChanged1);
            callback.WorkItemsChanged(eventType, items);
            Thread.Sleep(100);
            Assert.AreEqual(3, WorkItemChanged1Count);
            Assert.AreEqual(3, WorkItemChanged2Count);
            Assert.AreEqual(0, WorkItemChanged3Count);

            SubscribeAndPause(monitor, WorkItemChanged1);
            UnsubscribeAndPause(monitor, WorkItemChanged2);
            SubscribeAndPause(monitor, WorkItemChanged3);
            WaitForEvents(() => callback.WorkItemsChanged(eventType, items), 2);
            Assert.AreEqual(4, WorkItemChanged1Count);
            Assert.AreEqual(3, WorkItemChanged2Count);
            Assert.AreEqual(1, WorkItemChanged3Count);

            //TODO (Marmot): Expand to include multiple filters, etc.
        }