/// <summary> /// On click of button get selected Game from list and pass its params to Main ViewModel /// and close this window /// </summary> /// <param name="param">Selected game HRA</param> private void SelectGame() { HRA hra = Selected; int oblastID = (int)hra.oblast; MainVM main = Application.Current.MainWindow.DataContext as MainVM; main.OblastID = oblastID; main.GenerateGrid(); Application.Current.Windows.OfType <ContinueWindow>().First().Close(); }
/// <summary> /// On press of button add new difficulty level with selected height, width and number of mines /// With this difficulty create new game and get its ID /// Pass ID of game to Main ViewModel and close this window /// </summary> private void StartGame() { int obtiznostID = DBHelper.AddObtiznost(this.SelectedHeight, this.SelectedWidth, this.SelectedMine); int oblastID = DBHelper.AddGame(obtiznostID); MainVM main = Application.Current.MainWindow.DataContext as MainVM; main.OblastID = oblastID; main.GenerateGrid(); Application.Current.Windows.OfType <CustomWindow>().First().Close(); }