/// <summary> /// Alkalmazás indulásának eseménykezelője. /// </summary> private void App_Startup(object sender, StartupEventArgs e) { _dataAccess = new TicTacToeFileDataAccess(); _model = new BasicTicTacToeModel(_dataAccess); _model.GameWon += new EventHandler <GameWonEventArgs>(Model_GameWon); _model.GameOver += new EventHandler(Model_GameOver); _model.NewGame(); _viewModel = new TicTacToeViewModel(_model); _viewModel.LoadGame += new EventHandler(ViewModel_LoadGame); // kezeljük a nézetmodell eseményeit _viewModel.SaveGame += new EventHandler(ViewModel_SaveGame); _viewModel.GameExit += new EventHandler(ViewModel_GameExit); _window = new TicTacToeWindow(); _window.DataContext = _viewModel; _window.Show(); }
public string Evaluate(Context context) { try { var taskAttribute = context.Element.Attribute(Tag.TaskAttribute); if (taskAttribute != null) { var taskValue = taskAttribute.Value.ToLower(); if (taskValue == "start") { if (GameOn) { Window.Close(); } Window = new TicTacToeWindow(_botPlugin); Window.Show(); } else if (taskValue == "stop") { if (GameOn) { Window.Close(); } } else if (taskValue == "mark") { if (GameOn) { int outValue; if (int.TryParse(context.Element.Value, out outValue)) { Window.SetMove(outValue, PlayerType.Human); } } } } } catch (Exception exception) { VirtualAssistant.Instance.Logger.Error(exception); } return(string.Empty); }
private void ButtonStartNewGame_Click(object sender, RoutedEventArgs e) { var ticTacToeWindow = new TicTacToeWindow(); ShowNewWindow(ticTacToeWindow); }