/// <summary> /// Sets up Tournament through user inputs -> actual tournamtent-state prepairMode /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_StartTnmt_Click(object sender, RoutedEventArgs e) { if (checkTextBoxNotEmpty()) { INIFile tnmtIni = new INIFile(Tournament.iniPath); Tournament newTnmt = new Tournament(tbx_TnmtName.Text, Convert.ToInt32(tbx_TnmtRunCnt.Text), Convert.ToInt32(tbx_TnmtGameCnt.Text)); if (tbx_TnmtName.Text != null) { string specificTnmntPath = System.IO.Path.Combine(Const.CurDirPath, tbx_TnmtName.Text); Directory.CreateDirectory(specificTnmntPath); tnmtIni.SetValue(Const.fileSec, Tournament.fsX_SpecTnmtPath, specificTnmntPath); } UserControl prepMenue = new PrepaireMenue(mainWindow); mainWindow.MainContent.Content = prepMenue; } else { //MessageBox.Show("Bitte erfassen Sie alle geforderten Daten!", // "Nicht alle relevanten Felder wurden befüllt!", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.WarnMessage, "Fehlende Informationen!", "Einige Informationen die zum Anlegen eines Turniers benötigt werden fehlen!" + "\nBitte verfolständigen Sie diese!"); } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { Directory.CreateDirectory(Const.iniFolderPath); INIFile logFile = IniFileDataTemplate.CheckIfIniExists(Log.iniPath); INIFile playerData = IniFileDataTemplate.CheckIfIniExists(Player.iniPath); INIFile teamData = IniFileDataTemplate.CheckIfIniExists(Team.iniPath); INIFile tournamentData = IniFileDataTemplate.CheckIfIniExists(Tournament.iniPath); INIFile gameData = IniFileDataTemplate.CheckIfIniExists(Game.iniPath); INIFile tableData = IniFileDataTemplate.CheckIfIniExists(Table.iniPath); INIFile signedUpTeamsData = IniFileDataTemplate.CheckIfIniExists(SignedUpTeam.iniPath); actionMenueButton[0] = btn_GoToAddTeam; actionMenueButton[1] = btn_GoToEvaluation; actionMenueButton[2] = btn_GoToShowTeam; actionMenueButton[3] = btn_GoToTnmtData; actionMenueButton[4] = btn_GoTournamentMenue; Const.SwitchColor(this, actionMenueButton); UserControl creOLoaTnmt = new LoadOrCreateTournament(this); MainContent.Content = creOLoaTnmt; if (!checkIfTournamentIsRuning(tournamentData)) { // No running Tournament! Start New One and get needed Parameters //UserControl addTnmt = new AddTournament(this); //MainContent.Content = addTnmt; Tournament tnmt = new Tournament(); tnmt.Getter(); // Set for first run after creating new Tournament btn_GoToTnmtData.Style = (Style)Application.Current.Resources["StartTnmtButton"]; ActionMenue.Visibility = Visibility.Hidden; cnvs_PWHeader.Visibility = Visibility.Visible; } else if (checkIfTournamentIsInPrepMode(tournamentData)) { UserControl prepMenue = new PrepaireMenue(this); MainContent.Content = prepMenue; ActionMenue.Visibility = Visibility.Hidden; cnvs_PWHeader.Visibility = Visibility.Visible; } else { UserControl main = new Main(this); MainContent.Content = main; btn_GoToAddTeam.IsEnabled = true; btn_GoToShowTeam.IsEnabled = true; btn_GoToTnmtData.IsEnabled = true; btn_GoToEvaluation.IsEnabled = true; ActionMenue.Visibility = Visibility.Visible; cnvs_PWHeader.Visibility = Visibility.Hidden; if (Convert.ToInt32(tournamentData.GetValue(Tournament.tnmtSec, Tournament.tnS_tnmtRunCntAct)) != 0) { btn_GoToAddTeam.Style = (Style)Application.Current.Resources["DisabledButton"]; addTeamImg.Opacity = 0.5; btn_GoToAddTeam.Uid = NO_TEAM_ADDING; } if (Convert.ToInt32(tournamentData.GetValue(Tournament.tnmtSec, Tournament.tnS_tnmtRunCntAct)) == 0) { //btn_GoToTnmtData.Content = ""; btn_GoToTnmtData.Style = (Style)Application.Current.Resources["StartTnmtButton"]; } else { //btn_GoToTnmtData.Content = ""; btn_GoToTnmtData.Style = (Style)Application.Current.Resources["ActionMenueButton_" + tournamentData.GetValue(Const.fileSec, Tournament.fsX_ColorMode)]; } } }
private void btn_MainMenue_Click(object sender, RoutedEventArgs e) { UserControl prepMenue = new PrepaireMenue(mainWindow); mainWindow.MainContent.Content = prepMenue; }