private void InvitationReceived(object sender, InvitationHandshake e) { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed UsersListView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { try { _dispatcher.AddRequest(new EventRequest { RequestType = EventRequestType.AcceptInvitation, RequestObject = e.Invitation }); } catch (NullReferenceException ex) { Debug.WriteLine("NPE caught at InvitationReceived:" + ex.Message); } }); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }
public AvailableUsersListPage() { InitializeComponent(); _dispatcher = QuoridorEventDispatcher.getInstance(); quoridorWebService = _dispatcher.QuoridorWebService; // var task = DeserializeInvitations().Result; _dispatcher.AddRequest(new EventRequest { RequestType = EventRequestType.CheckAwaitingInvitation }); _dispatcher.AddRequest(new EventRequest { RequestType = EventRequestType.GetLoggedUsers }); if (_myInvitations.Count > 0) { _dispatcher.AddRequest(new EventRequest { RequestType = EventRequestType.CheckAcceptedInvitation, RequestObject = _myInvitations.FirstOrDefault() }); } }
public void TestGetLoggedIn() { var finished = new ManualResetEvent(false); _sut.LoggedUsersRefreshed += (sender, @event) => { _recivedEvents.Add(@event); finished.Set(); }; _sut.LogIn("Mateusz", "Bartczak"); _sut.AddRequest(new EventRequest() { RequestType = EventRequestType.GetLoggedUsers }); finished.WaitOne(); var users = (LoggedUsersRefreshed)_recivedEvents[0]; Assert.That(users.LoggedUsers, Is.Not.Null); }