public void onJoinRoomDone(RoomEvent roomEventObj) { if (roomEventObj.getResult() == WarpResponseResultCode.SUCCESS) { // reset the local global properties as we are starting a new game play session GlobalContext.GameRoomId = roomEventObj.getData().getId(); Debug.WriteLine("Room Joined !!"); WarpClient.GetInstance().SubscribeRoom(GlobalContext.GameRoomId); // get live information to fetch the name of the opponent if already inside WarpClient.GetInstance().GetLiveRoomInfo(GlobalContext.GameRoomId); Deployment.Current.Dispatcher.BeginInvoke(delegate() { Debug.WriteLine("On Joined Room"); if (GlobalContext.tableProperties["IsPrivateRoom"].Equals("true") && GlobalContext.AmIOwner) { GlobalContext.AmIOwner = false; Debug.WriteLine("Send Invitation"); MoveMessage.SendInvitation(); } else { App.g_HomePageListener.StartQuiz(); } }); } else { try { Deployment.Current.Dispatcher.BeginInvoke(delegate() { Debug.WriteLine("Room Joined Failed " + roomEventObj); WarpClient.GetInstance().CreateRoom("QuizRoom", "QuizRoom", GlobalContext.MaxUsersInRoom, GlobalContext.tableProperties); }); } catch (Exception e) { MessageBox.Show(e.Message); } } }
private void btnInvite_Click(object sender, RoutedEventArgs e) { GlobalContext.RemoteFacebookId = (sender as Button).Tag.ToString(); for (int i = 0; i < m_FbFriendList.Count; i++) { if (m_FbFriendList[i].facebookId.Equals(GlobalContext.RemoteFacebookId)) { GlobalContext.RemoteFacebookName = m_FbFriendList[i].username; } } if (GlobalContext.GameRoomId.Equals("")) { GlobalContext.AmIOwner = true; GlobalContext.tableProperties["IsPrivateRoom"] = "true"; WarpClient.GetInstance().CreateRoom("QuizRoom", "QuizRoom", GlobalContext.MaxUsersInRoom, GlobalContext.tableProperties); } else { MoveMessage.SendInvitation(); } messageGrid.Visibility = Visibility.Visible; }