public override void Execute(string packet) { UpdateRoomResponse updateRoomResponse = JsonConvert.DeserializeObject <UpdateRoomResponse>(packet); GameViewModel gvm = (ClientObject.view as GameViewModel); switch (updateRoomResponse.Type) { case UpdateRoomType.UpdatePlayers: bool isSelector = ClientObject.user.Login == updateRoomResponse.Selector.Login; Application.Current.Dispatcher.Invoke(() => { (((((MainWindow)Application.Current.MainWindow).Frame.Content as Game)?.GameFrame.Content) as CategoriesAndQuestionsTable)?.ChangeButtonEProp(isSelector); }); gvm.UpdatePoints(updateRoomResponse.Player); break; case UpdateRoomType.UpdateTable: Application.Current.Dispatcher.Invoke(() => { (((MainWindow)Application.Current.MainWindow).Frame.Content as Game).GameFrame.NavigationService.GoBack(); }); gvm.BlockAnswerButton(false); break; } }
public override void Execute(string packet) { BlockAnswerButtonResponse blockAnswerButtonResponse = JsonConvert.DeserializeObject <BlockAnswerButtonResponse>(packet); GameViewModel gvm = (ClientObject.view as GameViewModel); gvm.BlockAnswerButton(blockAnswerButtonResponse.IsEnabled); }
public override void Execute(string packet) { ShowQuestionResponse showQuestionResponse = JsonConvert.DeserializeObject <ShowQuestionResponse>(packet); GameViewModel gvm = ClientObject.view as GameViewModel; int questionId = showQuestionResponse.QuestionId; gvm.SelectedQuestionId = questionId; Application.Current.Dispatcher.Invoke(() => { (((((MainWindow)Application.Current.MainWindow).Frame.Content as Game)?.GameFrame.Content) as CategoriesAndQuestionsTable)?.HideButton(questionId); }); gvm.ShowQuestion(questionId); gvm.BlockAnswerButton(true); gvm.RemoveQuestion(questionId); }