Пример #1
0
		public static PollResult Get(ClientInfo clientInfo)
		{
			lock (CallbackResultItems)
			{
				var result = new PollResult();
				result.CallbackIndex = CallbackManager.Index;
				foreach (var callbackResultItem in CallbackResultItems)
				{
					if (callbackResultItem.CallbackResult.Index > clientInfo.CallbackIndex)
					{
						if (callbackResultItem.ClientType.HasValue && (callbackResultItem.ClientType.Value & clientInfo.ClientCredentials.ClientType) == ClientType.None)
							continue;
						if (callbackResultItem.ClientUID.HasValue && callbackResultItem.ClientUID.Value != clientInfo.UID)
							continue;
						if (callbackResultItem.CallbackResult.GKProgressCallback != null && callbackResultItem.CallbackResult.GKProgressCallback.IsCanceled)
							continue;
						if (!AutomationHelper.CheckLayoutFilter(callbackResultItem.CallbackResult.AutomationCallbackResult, clientInfo.LayoutUID))
							continue;
						if (callbackResultItem.CallbackResult.AutomationCallbackResult != null && callbackResultItem.CallbackResult.AutomationCallbackResult.Data is GlobalVariableCallBackData)
						{
							var data = callbackResultItem.CallbackResult.AutomationCallbackResult.Data as GlobalVariableCallBackData;
							if (data.InitialClientUID.HasValue && data.InitialClientUID.Value == clientInfo.UID)
								continue;
						}
						if (clientInfo.CallbackIndex < callbackResultItem.CallbackResult.Index)
							clientInfo.CallbackIndex = callbackResultItem.CallbackResult.Index;
						result.CallbackResults.Add(callbackResultItem.CallbackResult);
					}
				}
				return result;
			}
		}
Пример #2
0
		void ProcessPollResult(PollResult pollResult)
		{
			if (pollResult == null)
				return;

			CallbackIndex = pollResult.CallbackIndex;

			if (pollResult.IsReconnectionRequired)
			{
				Reconnect();
				return;
			}

			foreach (var callbackResult in pollResult.CallbackResults)
			{
				SafeContext.Execute(() =>
				{
					switch (callbackResult.CallbackResultType)
					{
						case CallbackResultType.GKProgress:
							if (GKProgressCallbackEvent != null)
								GKProgressCallbackEvent(callbackResult.GKProgressCallback);
							break;

						case CallbackResultType.GKObjectStateChanged:
							if (GKCallbackResultEvent != null)
								GKCallbackResultEvent(callbackResult.GKCallbackResult);
							break;

						case CallbackResultType.RviObjectStateChanged:
							if (RviCallbackResultEvent != null)
								RviCallbackResultEvent(callbackResult.RviCallbackResult);
							break;

						case CallbackResultType.GKPropertyChanged:
							if (GKPropertyChangedEvent != null)
								GKPropertyChangedEvent(callbackResult.GKPropertyChangedCallback);
							break;

						case CallbackResultType.OperationResult:
							if (CallbackOperationResultEvent != null)
								CallbackOperationResultEvent(callbackResult.CallbackOperationResult);
							break;

						case CallbackResultType.AutomationCallbackResult:
							ProcessAutomationCallback(callbackResult.AutomationCallbackResult);
							break;

						case CallbackResultType.NewEvents:
						case CallbackResultType.UpdateEvents:
							if (JournalItemsEvent != null)
								JournalItemsEvent(callbackResult.JournalItems, callbackResult.CallbackResultType == CallbackResultType.NewEvents);
							break;

						case CallbackResultType.ConfigurationChanged:
							if (ConfigurationChangedEvent != null)
								ConfigurationChangedEvent();
							break;
					}
				});
			}
		}