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()); } }
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; } }
public void NotifyArchiveCompleted(List<JournalRecord> journalRecords) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.ArchiveCompleted, JournalRecords = journalRecords }; CallbackManager.Add(callbackResult); }
public void NotifyNewJournal(List<JournalRecord> journalRecords) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.NewEvents, JournalRecords = journalRecords }; CallbackManager.Add(callbackResult); }
public static void NotifyGKObjectStateChanged(GKCallbackResult gkCallbackResult) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.GKObjectStateChanged, GKCallbackResult = gkCallbackResult }; CallbackManager.Add(callbackResult); }
public static void NotifyGKProgress(GKProgressCallback gkProgressCallback) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.GKProgress, GKProgressCallback = gkProgressCallback }; CallbackManager.Add(callbackResult); }
public void NotifyConfigurationChanged() { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.ConfigurationChanged }; CallbackManager.Add(callbackResult); }