public RoomReqListener(Results page) { System.Diagnostics.Debug.WriteLine("listener from result"); _page3 = page; }
public NotificationListener(Results page) { System.Diagnostics.Debug.WriteLine("notif listener from results"); _page3 = page; }
public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary<string, object> properties, Dictionary<string, string> lockedPropertiesTable) { var result = Global.p.All(x => properties.Any(y => x.Value == y.Value)); if(!Convert.ToBoolean(result)) { string text1 = String.Join(":", Global.p.Select(x => String.Format("{0}", x.Value)).ToArray()); string text2 = String.Join(":", properties.Select(x => String.Format("{0}", x.Value)).ToArray()); System.Diagnostics.Debug.WriteLine("property change detected\n"+ text1 +"\n" + text2); } Global.p = properties; if (_page != null) { if (_page3 != null) { _page3 = null; } if (_page2 != null) { _page2 = null; } if (Convert.ToInt16(properties["availUsers"]) == 2) { _page.timeout = -100; } if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"])) { System.Diagnostics.Debug.WriteLine("both are ready"); Deployment.Current.Dispatcher.BeginInvoke(() => { //_page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername; _page.but.Visibility = Visibility.Visible; _page.prog.Visibility = Visibility.Collapsed; }); } } if (_page2 != null) { if (_page != null) { _page = null; } if (_page3 != null) { _page3 = null; } if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"])) { System.Diagnostics.Debug.WriteLine("both ready for next question"); Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]); Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.p1.Value = Global.p1Score; _page2.p2.Value = Global.p2Score; // System.Threading.Thread.Sleep(1000); }); System.Diagnostics.Debug.WriteLine("score updated on UI"); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.milk(); System.Diagnostics.Debug.WriteLine("milk called"); }); } if (Convert.ToBoolean(properties["endgame0"]) && Convert.ToBoolean(properties["endgame1"])) { System.Diagnostics.Debug.WriteLine("both have ended"); Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]); Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.p1.Value = Global.p1Score; _page2.p2.Value = Global.p2Score; }); _page2.flag = 0; System.Diagnostics.Debug.WriteLine("score ui updated at end"); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.navigateR(); }); System.Diagnostics.Debug.WriteLine("navigating to results"); } } if(_page3 != null) { if (_page2 != null) { _page2 = null; } if (_page != null) { _page = null; } // sup } }
public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary <string, object> properties, Dictionary <string, string> lockedPropertiesTable) { var result = Global.p.All(x => properties.Any(y => x.Value == y.Value)); if (!Convert.ToBoolean(result)) { string text1 = String.Join(":", Global.p.Select(x => String.Format("{0}", x.Value)).ToArray()); string text2 = String.Join(":", properties.Select(x => String.Format("{0}", x.Value)).ToArray()); System.Diagnostics.Debug.WriteLine("property change detected\n" + text1 + "\n" + text2); } Global.p = properties; if (_page != null) { if (_page3 != null) { _page3 = null; } if (_page2 != null) { _page2 = null; } if (Convert.ToInt16(properties["availUsers"]) == 2) { _page.timeout = -100; } if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"])) { System.Diagnostics.Debug.WriteLine("both are ready"); Deployment.Current.Dispatcher.BeginInvoke(() => { //_page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername; _page.but.Visibility = Visibility.Visible; _page.prog.Visibility = Visibility.Collapsed; }); } } if (_page2 != null) { if (_page != null) { _page = null; } if (_page3 != null) { _page3 = null; } if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"])) { System.Diagnostics.Debug.WriteLine("both ready for next question"); Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]); Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.p1.Value = Global.p1Score; _page2.p2.Value = Global.p2Score; // System.Threading.Thread.Sleep(1000); }); System.Diagnostics.Debug.WriteLine("score updated on UI"); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.milk(); System.Diagnostics.Debug.WriteLine("milk called"); }); } if (Convert.ToBoolean(properties["endgame0"]) && Convert.ToBoolean(properties["endgame1"])) { System.Diagnostics.Debug.WriteLine("both have ended"); Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]); Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.p1.Value = Global.p1Score; _page2.p2.Value = Global.p2Score; }); _page2.flag = 0; System.Diagnostics.Debug.WriteLine("score ui updated at end"); Deployment.Current.Dispatcher.BeginInvoke(() => { _page2.navigateR(); }); System.Diagnostics.Debug.WriteLine("navigating to results"); } } if (_page3 != null) { if (_page2 != null) { _page2 = null; } if (_page != null) { _page = null; } // sup } }