private void Eva_Team_Data_Loaded(object sender, RoutedEventArgs e) { INIFile tnmtIni = new INIFile(Tournament.iniPath); Button[] iA_Buttons = { btn_CloseTeamGameInfo, btn_WindowInfo }; Settings.SwitchColorStyleDefaultButton(iA_Buttons); Const.SwitchColor(this); SolidColorBrush brush; brush = new SolidColorBrush(Const.SwitchFontColor()); lbl_sGameNr.Foreground = brush; lbl_sTeamPoints.Foreground = brush; lbl_swinPoints.Foreground = brush; lbl_sDiffPoints.Foreground = brush; lbl_oSumDiffPoints.Foreground = brush; lbl_oSumTeamPoints.Foreground = brush; lbl_sAponPoints.Foreground = brush; lbl_sGamePointsTotal.Foreground = brush; lbl_sTotal.Foreground = brush; INIFile gameIni = new INIFile(Game.iniPath); Tournament tnmt = new Tournament(); tnmt.Getter(); Data.MinHeight = tnmt.tnmtGameProRunCnt * tnmt.tnmtRunCnt * 28 + 100; int gameCnt = Convert.ToInt32(gameIni.GetValue(Const.fileSec, Game.fsX_gameCnt)); int playedGameCnt = tnmt.tnmtGameProRunCnt * tnmt.tnmtRunCnt; for (int i = 1; i <= gameCnt; i++) { Game gameOfIni = new Game(); gameOfIni.Getter(i); if (gameOfIni.gameTeams[0] == teamId) { FillLable(0, 1, gameOfIni); } else if (gameOfIni.gameTeams[1] == teamId) { FillLable(1, 0, gameOfIni); } } Team team = new Team(); team.Getter(teamId); lbl_oTeamName.Content = team.teamName; lbl_oTeamNr.Content = Convert.ToString(team.teamId); lbl_swinPoints.Content = Convert.ToString(team.winPoints); }
private void btn_endTournament_Click(object sender, RoutedEventArgs e) { INIFile suIni = new INIFile(SignedUpTeam.iniPath); Tournament tnmt = new Tournament(); tnmt.Getter(); bool saveSignedUpTeams = false; if (Convert.ToInt32(suIni.GetValue(Const.fileSec, SignedUpTeam.fsX_suTeamCnt)) > 0) { if (MessageBox.Show("Es wurden bereits Teams angemeldet.\nWollen Sie diese Teams speichern um Sie später laden zu können?", "Angemeldete Teams speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { saveSignedUpTeams = true; } } if (saveSignedUpTeams) { switchToFinishFolder(tnmt); } Directory.Delete(Const.iniFolderPath); mainWindow.Close(); }
private void btn_QuickRun_Click(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); UserControl inserRunData = new InsertRunData(this, tnmt.tnmtActRun); this.MainContent.Content = inserRunData; }
private void Settings_Loaded(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); lbl_oTnmtName.Content = tnmt.tnmtName; lbl_oRunCnt.Content = tnmt.tnmtRunCnt; lbl_oGamePerRunCnt.Content = tnmt.tnmtGameProRunCnt; }
private void btn_EditTnmtSettings_Save_Click(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); bool switchDir = false; string oldPath = ""; if (tnmt.tnmtName != tbx_iTnmtName.Text) { switchDir = true; oldPath = tnmtIni.GetValue(Const.fileSec, Tournament.fsX_SpecTnmtPath); } tnmt.tnmtName = tbx_iTnmtName.Text; tnmt.tnmtRunCnt = Convert.ToInt32(tbx_iRunCnt.Text); tnmt.Setter(); Log.Update("Tnmt-Name: " + lbl_oTnmtName.Content + "|" + tnmt.tnmtName); Log.Update("Tnmt-RunCnt: " + lbl_oRunCnt.Content + "|" + Convert.ToString(tnmt.tnmtRunCnt)); if (switchDir) { string specificTnmntPath = System.IO.Path.Combine(Const.CurDirPath, tbx_iTnmtName.Text); try { tnmtIni.SetValue(Const.fileSec, Tournament.fsX_SpecTnmtPath, specificTnmntPath); Directory.Move(oldPath, specificTnmntPath); Log.Update("Move " + oldPath + " after Tnmnt-Name Update to " + specificTnmntPath); Directory.Delete(oldPath); Log.Delete("Old Data after Tnmt-Name Update " + oldPath); } catch { Log.Error("Switching Tournament-Folder failed! Old Path:" + oldPath + " | new Path:" + specificTnmntPath); //MessageBox.Show("Bei der Änderung des Turniernamens kam es zu einem Fehler!" + // "\nBitte überprüfen Sie die Ordner:\n" + oldPath + "\n -> \n" + specificTnmntPath, // "Fehler bei Änderung des Turniernamens", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.ErrorMessage, "Fehler bei Änderung des Turniernamens", "Bei der Änderung des Turniernamens kam es zu einem Fehler!" + "\nBitte überprüfen Sie die Ordner:\n" + oldPath + "\n -> \n" + specificTnmntPath); } } Settings_Loaded(sender, e); SwitchEditMode(false); }
private void btn_QuitTnmt_Click(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); try { if (tnmt.tnmtRunCnt == tnmt.tnmtActRun) { if (MessageBox.Show("Wollen Sie das Tunier wirklich beenden?" + "\nDie Daten und die finale Rangliste werden gespeichert" + "\nSpeicherort: " + tnmt.tnmtSpecPath, "Tunier wirklich beenden?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Evaluation.SaveEva(); Log.Info("Tournament: " + tnmt.tnmtName + " QUIT-FINISHED"); switchToFinishFolder(tnmt); } } else { if (MessageBox.Show("Das Tunier ist noch nicht abgeschlossen!" + "\nWollen Sie das Tunier wirklich beenden?" + "\nDie Daten und die aktuelle Rangliste werden gespeichert" + "\nSpeicherort: " + tnmt.tnmtSpecPath, "Tunier wirklich beenden?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Evaluation.SaveEva(); Log.Info("Tournament: " + tnmt.tnmtName + " QUIT-NOT-FINISHED"); switchToFinishFolder(tnmt); } } } catch (Exception ex) { Log.Update(ex.ToString()); //MessageBox.Show("There is a pdfSharp.dll missing!!! Download it!", // "Missing Lib", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.ErrorMessage, "Missing Lib", "There i a pdfSharp.dll missing!! Download it!!"); } }
private void btn_PrintEvaluation_Click(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); SaveEva(); //MessageBox.Show("Rangliste wurde gespeichert!" + // "Speicherort: " + tnmt.tnmtSpecPath, // "Speichern erfolgreich", // MessageBoxButton.OK, // MessageBoxImage.Information); mainWindow.MessageBar(MainWindow.InfoMessage, "Speichern erfolgreich", "Rangliste wurde gespeichert!" + "\nSpeicherort: " + tnmt.tnmtSpecPath); }
private void btn_EditTeam_Click(object sender, RoutedEventArgs e) { if (cmbx_oiTeamShowerSelectTeam.SelectedIndex != -1) { tbx_iTSP1Firstname.Focus(); Tournament tnmt = new Tournament(); tnmt.Getter(); FillShowTeam(selectedTeam, player1, player2); btn_EditTeam.Visibility = Visibility.Hidden; btn_EditTeam_Save.Visibility = Visibility.Visible; btn_EditTeam_Clear.Visibility = Visibility.Visible; // Show Textbox and Hide Label tbx_oTeamName.Visibility = Visibility.Visible; tbx_iTSP1Firstname.Visibility = Visibility.Visible; tbx_iTSP1Lastname.Visibility = Visibility.Visible; tbx_iTSP2Firstname.Visibility = Visibility.Visible; tbx_iTSP2Lastname.Visibility = Visibility.Visible; if (tnmt.tnmtActRun == 0) { cbx_iTAP1Payed.IsEnabled = true; cbx_iTAP2Payed.IsEnabled = true; } else { cbx_iTAP1Payed.IsEnabled = false; cbx_iTAP2Payed.IsEnabled = false; } lbl_oTeamName.Visibility = Visibility.Hidden; lbl_iTSP1Firstname.Visibility = Visibility.Hidden; lbl_iTSP1Lastname.Visibility = Visibility.Hidden; lbl_iTSP2Firstname.Visibility = Visibility.Hidden; lbl_iTSP2Lastname.Visibility = Visibility.Hidden; } else { //MessageBox.Show("Wählen Sie zuerst ein Team aus um es zu bearbeiten!", // "Bearbeiten nicht möglich", // MessageBoxButton.OK, // MessageBoxImage.Error); mainWindow.MessageBar(MainWindow.ErrorMessage, "Bearbeitung nicht möglich", "Wählen Sie zuerst ein Team aus um es zu bearbeiten!"); } }
private void Settings_Loaded(object sender, RoutedEventArgs e) { Tournament tnmt = new Tournament(); tnmt.Getter(); lbl_oTnmtName.Content = tnmt.tnmtName; lbl_oRunCnt.Content = tnmt.tnmtRunCnt; lbl_oGamePerRunCnt.Content = tnmt.tnmtGameProRunCnt; if (mainWindow.debugMode) { cnvs_DebugModeActiv.Visibility = Visibility.Visible; cnvs_DebugModeDeactiv.Visibility = Visibility.Hidden; mainWindow.cnvs_debugModeActiv.Visibility = Visibility.Visible; mainWindow.debugMode = true; } else { cnvs_DebugModeActiv.Visibility = Visibility.Hidden; cnvs_DebugModeDeactiv.Visibility = Visibility.Visible; mainWindow.cnvs_debugModeActiv.Visibility = Visibility.Hidden; mainWindow.debugMode = false; } }
private void FillPlayedGameHistory() { INIFile tableIni = new INIFile(Table.iniPath); Tournament tnmt = new Tournament(); tnmt.Getter(); Team calledTeam = new Team(); calledTeam.Getter(calledTeamId); /// <summary> /// <para> /// 0,1: [0/1, 0/1/2, 0/1] -> 1/2 RUN 1/2/3 GAME 1/2 TEAM-POINTS /// </para> /// <para> /// 2: [0/1, 0/1/2, 2] -> 1/2 RUN 1/2/3 GAME X GAME ID /// </para> /// <para> /// 3: [0/1, 0/1/2, 2] -> 1/2 RUN 1/2/3 GAME X TABLE /// </para> /// <para> /// 4: [0/1, 0/1/2, 3] -> 1/2 RUN 1/2/3 GAME X APPONEND TEAM ID /// </para> /// </summary> //int[,,] gameStandings = GetGameStandings(calledTeam.teamId, tnmt); gameData[,] gameData = GetGameData(calledTeam.teamId, tnmt); int gamePointsTotal = 0; int diffTotal = 0; int rowsPerRun = 2 + tnmt.tnmtGameProRunCnt; cnvs_playedGameHistory.MinHeight = tnmt.tnmtRunCnt * rowsPerRun * 28 + 200; tableLable = new Label[tnmt.tnmtRunCnt * tnmt.tnmtGameProRunCnt, 6]; int gameDataIdentifyer = -1; for (int i = 0; i < tnmt.tnmtRunCnt; i++) { for (int x = -3; x < tnmt.tnmtGameProRunCnt; x++) { Label lbl_runId = new Label(); Label lbl_gameId = new Label(); Label lbl_calledTeam = new Label(); Label lbl_colon = new Label(); Label lbl_oppondTeam = new Label(); Label lbl_diffCalledTeam = new Label(); lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryDefLabel"]; if (x >= 0) { if (gameData[i, x].tableId != NOT_PLAYED) { gameDataIdentifyer++; lbl_runId.Content = String.Empty; lbl_gameId.Content = Convert.ToString(gameData[i, x].gameId); lbl_gameId.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_calledTeam.Content = Convert.ToString(gameData[i, x].calledTeamPoints); lbl_calledTeam.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_colon.Content = ":"; lbl_colon.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_oppondTeam.Content = (gameData[i, x].oppondTeamPoints < 10 ? " " : "") + Convert.ToString(gameData[i, x].oppondTeamPoints); lbl_oppondTeam.HorizontalContentAlignment = HorizontalAlignment.Left; lbl_diffCalledTeam.Content = Convert.ToString(gameData[i, x].calledTeamPoints - gameData[i, x].oppondTeamPoints); lbl_diffCalledTeam.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_runId.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_gameId.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_calledTeam.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_colon.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_oppondTeam.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_diffCalledTeam.MouseEnter += new MouseEventHandler(MarkUpActRow); lbl_runId.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_gameId.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_calledTeam.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_colon.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_oppondTeam.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_diffCalledTeam.MouseLeave += new MouseEventHandler(MarkDownActRow); lbl_runId.Uid = Convert.ToString(gameDataIdentifyer); lbl_gameId.Uid = Convert.ToString(gameDataIdentifyer); lbl_calledTeam.Uid = Convert.ToString(gameDataIdentifyer); lbl_colon.Uid = Convert.ToString(gameDataIdentifyer); lbl_oppondTeam.Uid = Convert.ToString(gameDataIdentifyer); lbl_diffCalledTeam.Uid = Convert.ToString(gameDataIdentifyer); tableLable[gameDataIdentifyer, 0] = lbl_runId; tableLable[gameDataIdentifyer, 1] = lbl_gameId; tableLable[gameDataIdentifyer, 2] = lbl_calledTeam; tableLable[gameDataIdentifyer, 3] = lbl_colon; tableLable[gameDataIdentifyer, 4] = lbl_oppondTeam; tableLable[gameDataIdentifyer, 5] = lbl_diffCalledTeam; gamePointsTotal += gameData[i, x].calledTeamPoints; diffTotal += gameData[i, x].calledTeamPoints - gameData[i, x].oppondTeamPoints; } else { lbl_runId.Content = String.Empty; lbl_gameId.Content = "-"; lbl_gameId.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_calledTeam.Content = "0"; lbl_calledTeam.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_colon.Content = ":"; lbl_colon.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_oppondTeam.Content = " 0"; lbl_oppondTeam.HorizontalContentAlignment = HorizontalAlignment.Left; lbl_diffCalledTeam.Content = "0"; lbl_diffCalledTeam.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; } } else { if (x == -3) { lbl_runId.Content = Convert.ToString(gameData[i, 0].runId); lbl_runId.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_gameId.Content = String.Empty; lbl_calledTeam.Content = "Tisch " + (gameData[i, 0].tableId == NOT_PLAYED ? "X" : Convert.ToString(gameData[i, 0].tableId)); lbl_colon.Content = String.Empty; lbl_oppondTeam.Content = String.Empty; lbl_diffCalledTeam.Content = String.Empty; if (gameData[i, 0].tableId != NOT_PLAYED) { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel"]; } else { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryRunTableHeaderLabel_NOTPLAYED"]; } } else if (x == -2) { Team opponedTeam = new Team(); opponedTeam.Getter(gameData[i, 0].oppondTeamId); lbl_runId.Content = String.Empty; lbl_gameId.Content = String.Empty; lbl_calledTeam.Content = calledTeam.teamName; lbl_calledTeam.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_colon.Content = "gegen"; lbl_colon.HorizontalContentAlignment = HorizontalAlignment.Center; if (opponedTeam.teamName != null) { lbl_oppondTeam.Content = opponedTeam.teamName; lbl_oppondTeam.HorizontalContentAlignment = HorizontalAlignment.Center; } else { lbl_oppondTeam.Content = String.Empty; } lbl_diffCalledTeam.Content = String.Empty; if (gameData[i, 0].tableId != NOT_PLAYED) { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel"]; } else { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryTeamNamesLabel_NOTPLAYED"]; } } else { lbl_runId.Content = String.Empty; lbl_gameId.Content = String.Empty; lbl_calledTeam.Content = "Gewinn-Punkte: " + Convert.ToString(gameData[i, 0].winPointsTeamCalled); lbl_calledTeam.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_colon.Content = "zu"; lbl_colon.HorizontalContentAlignment = HorizontalAlignment.Center; lbl_oppondTeam.Content = Convert.ToString(gameData[i, 0].winPointsTeamOppond); lbl_diffCalledTeam.Content = String.Empty; if (gameData[i, 0].tableId != NOT_PLAYED) { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel"]; } else { lbl_runId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_gameId.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_calledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_colon.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_oppondTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; lbl_diffCalledTeam.Style = (Style)Application.Current.Resources["playedGameHistoryGameDataLabel_NOTPLAYED"]; } } } //Separator sep = new Separator(); stp_RunDATA.Children.Add(lbl_runId); //stp_RunDATA.Children.Add(sep); //sep = new Separator(); stp_GameNrDATA.Children.Add(lbl_gameId); //stp_GameNrDATA.Children.Add(sep); //sep = new Separator(); stp_CalledTeamNameDATA.Children.Add(lbl_calledTeam); //stp_CalledTeamNameDATA.Children.Add(sep); //sep = new Separator(); stp_ColonDATA.Children.Add(lbl_colon); //stp_ColonDATA.Children.Add(sep); //sep = new Separator(); stp_OppondTeamNameDATA.Children.Add(lbl_oppondTeam); //stp_OppondTeamNameDATA.Children.Add(sep); //sep = new Separator(); stp_DiffDATA.Children.Add(lbl_diffCalledTeam); //stp_DiffDATA.Children.Add(sep); } } lbl_oGamePointsTotal.Content = "Spiel-Punkte gesamt: " + (gamePointsTotal < 10 ? " " : " ") + Convert.ToString(gamePointsTotal); lbl_oGamePointsTotal.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_oWinPointsTotal.Content = "Gewinn-Punkte gesamt:" + (calledTeam.winPoints <10 && calledTeam.winPoints> -10 ? " " : " ") + Convert.ToString(calledTeam.winPoints); lbl_oWinPointsTotal.HorizontalContentAlignment = HorizontalAlignment.Right; lbl_oDiffTotal.Content = "Gesamt: " + (diffTotal <10 && diffTotal> -10 ? " " : " ") + Convert.ToString(diffTotal); lbl_oDiffTotal.HorizontalContentAlignment = HorizontalAlignment.Right; }
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)]; } } }
public static void SaveEva() { Tournament tnmt = new Tournament(); INIFile tnmtIni = new INIFile(Tournament.iniPath); tnmt.Getter(); Team[] evaTeams = new Team[tnmt.tnmtTeamCnt]; for (int i = 0; i < evaTeams.Length; i++) { Team addTeam = new Team(); addTeam.Getter(i + 1); evaTeams[i] = addTeam; } SortTeamsByWinAndGamePoints(evaTeams); PdfDocument pdf = new PdfDocument(); PdfPage page = pdf.AddPage(); XGraphics graph = XGraphics.FromPdfPage(page); XFont fontHeader = new XFont("Verdana", 20, XFontStyle.Bold); XFont fontLine = new XFont("Courier New", 12, XFontStyle.Regular); XFont fontLineInfo = new XFont("Courier New", 12, XFontStyle.Bold); XFont fontNotFinishedState = new XFont("Courier New", 12, XFontStyle.Bold); //graph.DrawString("Ranglist " + tnmt.tnmtName, fontHeader, XBrushes.Black, new XRect(10, 10, page.Width.Point, page.Height.Point), XStringFormats.TopCenter); SetHeader(tnmt, fontHeader, page, graph); string line = ""; int yPoint = 40; //if (CheckTnmtNotFinishState(tnmtIni)) //{ // line = "ZUM ZEITPUNKT DER ERSTELLUNG DIESER DATEI WAR DAS TURNIER NOCH NICHT BEENDET!"; // graph.DrawString(line, notFinishedState, XBrushes.Black, new XRect(10, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); // yPoint += 20; //} SetTnmtNotFinishState(tnmtIni, line, fontNotFinishedState, page, graph, ref yPoint); //line = "Allgemine Daten:"; //graph.DrawString(line, fontLineInfo, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 20; //line = " Anzahl Durchgänge: " + Convert.ToString(tnmt.tnmtRunCnt); //graph.DrawString(line, fontLine, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 20; //line = " Anzahl Spiel/Druchgang: " + Convert.ToString(tnmt.tnmtGameProRunCnt); //graph.DrawString(line, fontLine, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 20; //line = " Anzahl Teams: " + Convert.ToString(tnmt.tnmtTeamCnt); //graph.DrawString(line, fontLine, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 50; SetDefaultData(tnmt, ref line, fontLineInfo, fontLine, page, graph, ref yPoint); int x = 0; line = ""; //line = Const.posHeader + "|" + Const.teamNumberHeader + "|" + Const.teamNameHeader + "|" + Const.winPointsHeader + "|" + Const.gamePointsDiffHeader; //graph.DrawString(line, fontLineInfo, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 20; //line = ""; int pageNumber = 1; double rowCntperPage = 22; double pageCnt = tnmt.tnmtTeamCnt <= rowCntperPage ? 1 : (tnmt.tnmtTeamCnt / rowCntperPage); pageCnt = (int)pageCnt < (tnmt.tnmtTeamCnt / rowCntperPage) ? pageCnt + 1 : pageCnt; SetPageNumber(ref line, pageNumber, (int)pageCnt, fontLineInfo, page, graph, ref yPoint); SetTableHeader(ref line, fontLineInfo, page, graph, ref yPoint); //graph.DrawString(SetRow(), fontLineInfo, XBrushes.Black, new XRect(40, yPoint, page.Width.Point, page.Height.Point), XStringFormats.TopLeft); //yPoint += 20; int rowCnt = 0; foreach (Team team in evaTeams) { if (rowCnt < rowCntperPage) { x++; SetTableRowData(ref line, team, x, fontLineInfo, fontLine, page, graph, ref yPoint); rowCnt++; } else { page = pdf.AddPage(); graph = XGraphics.FromPdfPage(page); rowCnt = 1; yPoint = 40; pageNumber += 1; SetTimeStamp(ref line, fontLineInfo, page, graph, ref yPoint); yPoint += 110; SetPageNumber(ref line, pageNumber, (int)pageCnt, fontLineInfo, page, graph, ref yPoint); SetTableHeader(ref line, fontLineInfo, page, graph, ref yPoint); x++; SetTableRowData(ref line, team, x, fontLineInfo, fontLine, page, graph, ref yPoint); } } if (!Directory.Exists(tnmt.tnmtSpecPath)) { Directory.CreateDirectory(tnmt.tnmtSpecPath); Log.Create("Directory: " + tnmt.tnmtSpecPath); } string pdfFileName = ""; string pdfFilePath = ""; try { pdfFileName = "Rangliste_" + tnmt.tnmtName + "_" + DateTime.Now.ToShortDateString() + ".pdf"; pdfFilePath = System.IO.Path.Combine(tnmt.tnmtSpecPath, pdfFileName); pdf.Save(pdfFilePath); Log.Create("Evaluation-PDF: " + pdfFileName + " | saved at: " + pdfFilePath); } catch { Log.Error("creating Evaluation-PDF: " + pdfFileName + " tried to save at: " + pdfFilePath); } }