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;
			}
		}
Exemple #2
0
		public static bool Add(Guid uid, ClientCredentials clientCredentials)
		{
			if (ClientInfos.Any(x => x.UID == uid))
				return false;

			var result = true;
			var existingClientInfo = ClientInfos.FirstOrDefault(x => x.ClientCredentials.UniqueId == clientCredentials.UniqueId);
			if (existingClientInfo != null)
			{
				Remove(existingClientInfo.UID);
				result = false;
			}

			var clientInfo = new ClientInfo();
			clientInfo.UID = uid;
			clientInfo.ClientCredentials = clientCredentials;
			ClientInfos.Add(clientInfo);

			MainViewModel.Current.AddClient(clientCredentials);
			return result;
		}