示例#1
0
		public static void Add(CallbackResult callbackResult)
		{
			lock (CallbackResultItems)
			{
				CallbackResultItems.RemoveAll(x => (DateTime.Now - x.DateTime) > TimeSpan.FromMinutes(1));

				Index++;
				var newCallbackResultItem = new CallbackResultItem()
				{
					CallbackResult = callbackResult,
					Index = Index,
					DateTime = DateTime.Now
				};
				CallbackResultItems.Add(newCallbackResultItem);

				if (callbackResult.CallbackResultType == CallbackResultType.GKProgress)
				{
					var callbackResultItem = CallbackResultItems.FirstOrDefault(x => x.CallbackResult.GKProgressCallback != null && x.CallbackResult.GKProgressCallback.UID == callbackResult.GKProgressCallback.UID);
					if (callbackResultItem != null)
					{
						if (callbackResult.GKProgressCallback.LastActiveDateTime > callbackResultItem.CallbackResult.GKProgressCallback.LastActiveDateTime)
						{
							CallbackResultItems.Remove(callbackResultItem);
						}
					}
				}

				ClientsManager.ClientInfos.ForEach(x => x.WaitEvent.Set());
			}
		}
示例#2
0
		public static List<CallbackResult> Get(ClientInfo clientInfo)
		{
			lock (CallbackResultItems)
			{
				var result = new List<CallbackResult>();
				if (clientInfo.IsDisconnecting)
				{
					var callbackResult = new CallbackResult()
					{
						CallbackResultType = CallbackResultType.Disconnecting
					};
					result.Add(callbackResult);
					return result;
				}
				foreach (var callbackResultItem in CallbackResultItems)
				{
					if (callbackResultItem.Index > clientInfo.CallbackIndex)
					{
						if (!(callbackResultItem.CallbackResult.GKProgressCallback != null && callbackResultItem.CallbackResult.GKProgressCallback.IsCanceled))
							result.Add(callbackResultItem.CallbackResult);
					}
				}
				clientInfo.CallbackIndex = Index;
				return result;
			}
		}
示例#3
0
 public void NotifyArchiveCompleted(List<JournalRecord> journalRecords)
 {
     var callbackResult = new CallbackResult()
     {
         CallbackResultType = CallbackResultType.ArchiveCompleted,
         JournalRecords = journalRecords
     };
     CallbackManager.Add(callbackResult);
 }
示例#4
0
 public void NotifyNewJournal(List<JournalRecord> journalRecords)
 {
     var callbackResult = new CallbackResult()
     {
         CallbackResultType = CallbackResultType.NewEvents,
         JournalRecords = journalRecords
     };
     CallbackManager.Add(callbackResult);
 }
示例#5
0
		public static void NotifyGKObjectStateChanged(GKCallbackResult gkCallbackResult)
		{
			var callbackResult = new CallbackResult()
			{
				CallbackResultType = CallbackResultType.GKObjectStateChanged,
				GKCallbackResult = gkCallbackResult
			};
			CallbackManager.Add(callbackResult);
		}
示例#6
0
		public static void NotifyGKProgress(GKProgressCallback gkProgressCallback)
		{
			var callbackResult = new CallbackResult()
			{
				CallbackResultType = CallbackResultType.GKProgress,
				GKProgressCallback = gkProgressCallback
			};
			CallbackManager.Add(callbackResult);
		}
示例#7
0
 public void NotifyConfigurationChanged()
 {
     var callbackResult = new CallbackResult()
     {
         CallbackResultType = CallbackResultType.ConfigurationChanged
     };
     CallbackManager.Add(callbackResult);
 }