public static void NotifyAutomation(AutomationCallbackResult automationCallbackResult, Guid? clientUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.AutomationCallbackResult, AutomationCallbackResult = automationCallbackResult, }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other, clientUID); }
public static void NotifyGKObjectStateChanged(GKCallbackResult gkCallbackResult) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.GKObjectStateChanged, GKCallbackResult = gkCallbackResult }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other); }
public static void NotifyRviObjectStateChanged(RviCallbackResult rviCallbackResult) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.RviObjectStateChanged, RviCallbackResult = rviCallbackResult }; CallbackManager.Add(callbackResult, ClientType.Monitor); }
public static void Add(CallbackResult callbackResult, ClientType? clientType = null, Guid? clientUID = null) { lock (CallbackResultItems) { var minIndex = ClientsManager.ClientInfos.Any() ? ClientsManager.ClientInfos.Min(x => x.CallbackIndex) : 0; CallbackResultItems.RemoveAll(x => x.CallbackResult.Index <= minIndex || (DateTime.Now - x.DateTime) > TimeSpan.FromDays(1)); callbackResult.Index = ++Index; var newCallbackResultItem = new CallbackResultItem() { CallbackResult = callbackResult, DateTime = DateTime.Now, ClientType = clientType, ClientUID = clientUID }; 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 && callbackResult.GKProgressCallback.LastActiveDateTime > callbackResultItem.CallbackResult.GKProgressCallback.LastActiveDateTime) CallbackResultItems.Remove(callbackResultItem); } if (callbackResult.AutomationCallbackResult != null && callbackResult.AutomationCallbackResult.Data is PlanCallbackData) { var callbackResultData = callbackResult.AutomationCallbackResult.Data as PlanCallbackData; foreach (var callbackResultItem in CallbackResultItems) if (callbackResultItem.CallbackResult.AutomationCallbackResult != null && callbackResultItem.CallbackResult.AutomationCallbackResult.Data is PlanCallbackData) { var callbackResuultItemData = callbackResultItem.CallbackResult.AutomationCallbackResult.Data as PlanCallbackData; if (callbackResultData.ElementUid == callbackResuultItemData.ElementUid && callbackResultData.ElementPropertyType == callbackResuultItemData.ElementPropertyType && callbackResultData.ElementUid == callbackResuultItemData.ElementUid && callbackResult.AutomationCallbackResult.CallbackUID != callbackResultItem.CallbackResult.AutomationCallbackResult.CallbackUID) { CallbackResultItems.Remove(callbackResultItem); break; } }; } foreach (var clientInfo in ClientsManager.ClientInfos) { if (clientType.HasValue && (clientType.Value & clientInfo.ClientCredentials.ClientType) == ClientType.None) continue; if (clientUID.HasValue && clientUID.Value != clientInfo.UID) continue; if (!AutomationHelper.CheckLayoutFilter(callbackResult.AutomationCallbackResult, clientInfo.LayoutUID)) continue; clientInfo.WaitEvent.Set(); } } }
public static void NotifyGKProgress(GKProgressCallback gkProgressCallback, Guid? clientUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.GKProgress, GKProgressCallback = gkProgressCallback }; ClientType? clientType = null; if (gkProgressCallback != null) clientType = gkProgressCallback.GKProgressClientType == GKProgressClientType.Administrator ? ClientType.Administrator : ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other; CallbackManager.Add(callbackResult, clientType, clientUID); }
public static void NotifyConfigurationChanged() { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.ConfigurationChanged }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other); }
public static void NotifyJournalItems(List<JournalItem> journalItems, bool isNew) { var callbackResult = new CallbackResult() { CallbackResultType = isNew ? CallbackResultType.NewEvents : CallbackResultType.UpdateEvents, JournalItems = journalItems }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other); }
public static void NotifyOperationResult_GetJournal(OperationResult<List<JournalItem>> result, Guid clientUid, Guid journalClientUid) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.OperationResult, CallbackOperationResult = new CallbackOperationResult { CallbackOperationResultType = CallbackOperationResultType.GetJournal, Error = result.Error, HasError = result.HasError, JournalItems = result.Result, ClientUid = journalClientUid, } }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other, clientUid); }
public static void NotifyOperationResult_GetArchivePage(OperationResult<List<JournalItem>> result, Guid clientUid, string userName) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.OperationResult, CallbackOperationResult = new CallbackOperationResult { CallbackOperationResultType = CallbackOperationResultType.GetArchivePage, Error = result.Error, HasError = result.HasError, JournalItems = result.Result, UserName = userName, } }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other, clientUid); }
public static void NotifyOperationResult_ReadConfigurationFromGKFile(OperationResult<string> result, Guid? clientUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.OperationResult, CallbackOperationResult = new CallbackOperationResult() { CallbackOperationResultType = CallbackOperationResultType.ReadConfigurationFromGKFile, Error = result.Error, HasError = result.HasError, FileName = result.Result } }; CallbackManager.Add(callbackResult, ClientType.Administrator, clientUID); }
public static void NotifyOperationResult_WriteConfiguration(OperationResult<bool> result, Guid? clientUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.OperationResult, CallbackOperationResult = new CallbackOperationResult() { CallbackOperationResultType = CallbackOperationResultType.WriteConfiguration, Error = result.Error, HasError = result.HasError, } }; CallbackManager.Add(callbackResult, ClientType.Administrator, clientUID); }
public static void NotifyOperationResult_GetAllUsers(OperationResult<List<GKUser>> result, bool isGk, Guid? clientUID, Guid deviceUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.OperationResult, CallbackOperationResult = new CallbackOperationResult() { CallbackOperationResultType = isGk ? CallbackOperationResultType.GetGKUsers : CallbackOperationResultType.GetPmfUsers, Error = result.Error, HasError = result.HasError, Users = result.Result, DeviceUID = deviceUID } }; CallbackManager.Add(callbackResult, ClientType.Administrator, clientUID); }
public static void NotifyGKParameterChanged(Guid objectUID, List<GKProperty> deviceProperties, Guid? clientUID) { var callbackResult = new CallbackResult() { CallbackResultType = CallbackResultType.GKPropertyChanged, GKPropertyChangedCallback = new GKPropertyChangedCallback() { ObjectUID = objectUID, DeviceProperties = deviceProperties } }; CallbackManager.Add(callbackResult, ClientType.Monitor | ClientType.OPC | ClientType.WebService | ClientType.Other); }