/// <summary> /// Updates the specified sender. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void Update(object sender, Recive e) { this.Dispatcher.Invoke(() => { if (updateCommands.ContainsKey(e.type)) { updateCommands[e.type].Execute(e.result, currentWindow); } }); }
/// <summary> /// Initializes the game. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> public void InitializeGame(object sender = null, Recive e = null) { if (sender == null) { gameFlow.Invoke(this, new Recive("initializeGame", null)); } else { gameFlow.Invoke(sender, e); } }
/// <summary> /// Updates the screen. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void UpdateScreen(object sender, Recive e) { this.Dispatcher.Invoke(() => { this.Show(); singleplayer_button.IsEnabled = true; multiplayer_button.IsEnabled = true; settings_button.IsEnabled = true; if (sender is IServerModel) { currentWindow.Close(); // send a command window - disconnected InvalidCommand invalidCommand = new InvalidCommand(viewModel, "Partner disconnected"); invalidCommand.ShowDialog(); } }); }
/// <summary> /// Recives the information. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void ReciveInfo(object sender, Recive e) { this.Dispatcher.Invoke(() => { if (windowMessages.ContainsKey(e.result)) { windowMessages[e.result].Execute(e.result, viewModel); // hide multiplayer waiting window if (currentWindow is MultiPlayerMenu) { ((MultiPlayerMenu)(currentWindow)).HideWaiting(); } else { singleplayer_button.IsEnabled = false; multiplayer_button.IsEnabled = false; settings_button.IsEnabled = false; } } else { Window oldWindow = currentWindow; if (commands.ContainsKey(e.type)) { oldWindow.Hide(); currentWindow = commands[e.type].Execute(e.result, viewModel); currentWindow.DataContext = viewModel; if (oldWindow is MultiPlayerMenu) { ((MultiPlayerMenu)oldWindow).GameBegin = true; } oldWindow.Close(); ShowDialog(); } } }); }
/// <summary> /// Recives the information. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void ReciveInfo(object sender, Recive e) { result.Invoke(this, e); }
/// <summary> /// Updates the specified sender. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void Update(object sender, Recive e) { updateResult.Invoke(this, e); }