private void btn_PWHeader_Click(object sender, RoutedEventArgs e) { Button thisBtn = (Button)sender; if (thisBtn.Uid != NO_RETURN) { UserControl creOLoaTnmt = new LoadOrCreateTournament(this); MainContent.Content = creOLoaTnmt; } }
private void btn_LoadTnmt_Click(object sender, RoutedEventArgs e) { bool loadFailed = false; try { foreach (var srcPath in Directory.GetFiles(tbx_filePath.Text)) { //Copy the file from sourcepath and place into mentioned target path, //Overwrite the file if same file is exist in target path File.Copy(srcPath, srcPath.Replace(tbx_filePath.Text, Const.iniFolderPath), true); } }catch { loadFailed = true; Log.Error("Not able to load Files from " + tbx_filePath.Text); //System.Windows.MessageBox.Show("Es war nicht möglich diese Tunierdaten zu laden!" + // "\nStellen Sie sicher, dass Sie aus einem \"Finished_Tournament\" - Ordner laden!", // "Laden nicht möglich", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.ErrorMessage, "Laden nicht möglich", "Es war nicht möglich diese Tunierdaten zu laden!" + "\nStellen Sie sicher, dass Sie aus einem \"Finished_Tournament\" - Ordner laden!"); } if (!loadFailed) { INIFile tnmtIni = new INIFile(Tournament.iniPath); try { string specificTnmntPath = System.IO.Path.Combine(Const.CurDirPath, tnmtIni.GetValue(Tournament.tnmtSec, Tournament.tnS_tnmtName)); Directory.CreateDirectory(specificTnmntPath); tnmtIni.SetValue(Const.fileSec, Tournament.fsX_SpecTnmtPath, specificTnmntPath); System.Windows.Controls.UserControl main = new Main(mainWindow); mainWindow.MainContent.Content = main; } catch { loadFailed = true; Log.Error("Not able to load Files from " + tbx_filePath.Text); //System.Windows.MessageBox.Show("Es war nicht möglich diese Tunierdaten zu laden!" + // "\nStellen Sie sicher, dass Sie aus einem \"Finished_Tournament\" - Ordner laden!", // "Laden nicht möglich", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.ErrorMessage, "Laden nicht möglich", "Es war nicht möglich diese Tunierdaten zu laden!" + "\nStellen Sie sicher, dass Sie aus einem \"Finished_Tournament\" - Ordner laden!"); loadFailed = true; } } if (loadFailed) { System.Windows.Controls.UserControl loadorcreate = new LoadOrCreateTournament(mainWindow); mainWindow.MainContent.Content = loadorcreate; } }
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)]; } } }