Пример #1
0
        private void TeamSwap_Loaded(object sender, RoutedEventArgs e)
        {
            Button[] iA_Buttons =
            {
                btn_Close
            };
            Settings.SwitchColorStyleDefaultButton(iA_Buttons);
            Const.SwitchColor(this);

            btn_Switch.IsEnabled = false;
            SwitchImg.Opacity    = 0.5;

            FillTeamSwap();
        }
Пример #2
0
        public void SetCompleteState(int i_runId, bool i_state)
        {
            INIFile tnIni = new INIFile(Tournament.iniPath);

            Const.SetIniTimeStamp(tnIni);
            if (Const.CheckIdInRange(tnIni, Tournament.tnmtSec, Tournament.tnS_tnmtRunCnt, i_runId))
            {
                string strId = Convert.ToString(i_runId);
                tnIni.SetValue(Tournament.runSec + strId, Tournament.rS_runComplete, Convert.ToString(i_state));
                Log.Info("Run " + Convert.ToString(i_runId) + " completed");
            }
            else
            {
                Log.Error("Run-SetCompleteState input Id " + i_runId + " out of Range!");
            }
        }
Пример #3
0
        public void Getter(int i_id)
        {
            INIFile gIni = new INIFile(iniPath);

            if (Const.CheckIdInRange(gIni, Const.fileSec, fsX_gameCnt, i_id))
            {
                string strId = Convert.ToString(i_id);
                gameId        = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_gameId));
                gameTeams[0]  = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_gameTeam1));
                gameTeams[1]  = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_gameTeam2));
                gamePoints[0] = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_gamePointsTeam1));
                gamePoints[1] = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_gamePointsTeam2));
                dpndRun       = Convert.ToInt32(gIni.GetValue(gameSec + strId, gS_dpndRun));
            }
            else
            {
                Log.Error("Game-Getter input Id " + i_id + " out of Range!");
            }
        }
Пример #4
0
        public void Getter(int i_id)
        {
            INIFile sutIni = new INIFile(iniPath);

            if (Const.CheckIdInRange(sutIni, Const.fileSec, fsX_suTeamCnt, i_id))
            {
                suTeamId = i_id;
                string strId = Convert.ToString(i_id);
                suTeamName = sutIni.GetValue(suTeamSec + strId, sutS_suTName);
                suTeamPlayerFirstNames[0] = sutIni.GetValue(suTeamSec + strId, sutS_suTPlayer1Firstname);
                suTeamPlayerFirstNames[1] = sutIni.GetValue(suTeamSec + strId, sutS_suTPlayer2Firstname);
                suTeamPlayerLastNames[0]  = sutIni.GetValue(suTeamSec + strId, sutS_suTPlayer1Lastname);
                suTeamPlayerLastNames[1]  = sutIni.GetValue(suTeamSec + strId, sutS_suTPlayer2Lastname);
            }
            else
            {
                Log.Error("Team-Getter input Id " + i_id + " out of Range!");
            }
        }
Пример #5
0
        public void Getter(int i_id)
        {
            INIFile tIni = new INIFile(iniPath);

            if (Const.CheckIdInRange(tIni, fileSec, fsX_teamCnt, i_id))
            {
                teamId = i_id;
                string strId = Convert.ToString(i_id);
                teamName            = tIni.GetValue(teamSec + strId, tS_teamName);
                teamPlayer[0]       = Convert.ToInt32(tIni.GetValue(teamSec + strId, tS_player1Id));
                teamPlayer[1]       = Convert.ToInt32(tIni.GetValue(teamSec + strId, tS_player2Id));
                winPoints           = Convert.ToInt32(tIni.GetValue(teamSec + strId, tS_winPoints));
                gamePointsTotal     = Convert.ToInt32(tIni.GetValue(teamSec + strId, tS_gamePointsTotal));
                gamePointsTotalDiff = Convert.ToInt32(tIni.GetValue(teamSec + strId, tS_gamePointsTotalDiff));
            }
            else
            {
                Log.Error("Team-Getter input Id " + i_id + " out of Range!");
            }
        }
Пример #6
0
        public void Getter(int i_id)
        {
            INIFile tnIni = new INIFile(Tournament.iniPath);

            if (i_id != 0)
            {
                if (Const.CheckIdInRange(tnIni, Tournament.tnmtSec, Tournament.tnS_tnmtRunCnt, i_id))
                {
                    runId         = Convert.ToInt32(tnIni.GetValue(Tournament.runSec + i_id, Tournament.rS_runId));
                    tableCnt      = Convert.ToInt32(tnIni.GetValue(Tournament.runSec + runId, Tournament.rS_tableCnt));
                    completeState = Convert.ToBoolean(tnIni.GetValue(Tournament.runSec + runId, Tournament.rS_runComplete));
                }
                else
                {
                    Log.Error("Run-Getter input Id " + i_id + " out of Range!");
                }
            }
            else
            {
                completeState = true;
            }
        }
Пример #7
0
        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();
            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);

            if (winCnt == team.winPoints)
            {
                lbl_swinPoints.Content = Convert.ToString(team.winPoints);
            }
            else
            {
                lbl_swinPoints.Content = Convert.ToString(winCnt) + "(+" + Convert.ToString(team.winPoints - winCnt) + ")";
            }
        }
Пример #8
0
 public void InfoWindow_Loaded(object sender, RoutedEventArgs e)
 {
     Const.SwitchColor(this);
 }
Пример #9
0
        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)];
                }
            }
        }
Пример #10
0
        public void Evaluation_Loaded(object sender, RoutedEventArgs e)
        {
            INIFile teamIni = new INIFile(Team.iniPath);
            INIFile tnmtIni = new INIFile(Tournament.iniPath);

            Button[] iA_Btns =
            {
                btn_MainMenue,
                btn_PrintEvaluation
            };

            Settings.SwitchColorStyleDefaultButton(iA_Btns);

            if (CheckTnmtNotFinishState(tnmtIni))
            {
                lbl_oTnmtFinishStatement.Visibility = Visibility.Visible;
            }
            else
            {
                lbl_oTnmtFinishStatement.Visibility = Visibility.Hidden;
            }

            SolidColorBrush brush;

            brush = new SolidColorBrush(Const.SwitchFontColor());
            lbl_sPosHeader.Foreground        = brush;
            lbl_sTeamHeader.Foreground       = brush;
            lbl_sWinPointsHeader.Foreground  = brush;
            lbl_sGamePointsHeader.Foreground = brush;
            lbl_sInfoHeader.Foreground       = brush;


            if (Convert.ToInt32(teamIni.GetValue(Const.fileSec, Team.fsX_teamCnt)) != 0)
            {
                Team[] allTeams = new Team[Convert.ToInt32(teamIni.GetValue(Const.fileSec, Team.fsX_teamCnt))];

                for (int i = 0; i < allTeams.Length; i++)
                {
                    Team addTeam = new Team();
                    addTeam.Getter(i + 1);
                    allTeams[i] = addTeam;
                }

                SortTeamsByWinAndGamePoints(allTeams);

                Label lbl_rowNumber      = new Label();
                Label lbl_teamName       = new Label();
                Label lbl_winPoints      = new Label();
                Label lbl_gamePointsDiff = new Label();

                int x = 0;
                last = allTeams.Length;

                tabelLabel = new Label[allTeams.Length, 4];

                //do
                //{
                foreach (Team team in allTeams)
                {
                    #region create Button n Lable for Table
                    Separator sep = new Separator();
                    Button    btn_teamGameInfo = new Button();
                    x++;
                    lbl_rowNumber      = new Label();
                    lbl_teamName       = new Label();
                    lbl_winPoints      = new Label();
                    lbl_gamePointsDiff = new Label();

                    //lbl_rowNumber.Background = Brushes.Transparent;
                    //lbl_teamName.Background = Brushes.Transparent;
                    //lbl_winPoints.Background = Brushes.Transparent;
                    //lbl_gamePointsDiff.Background = Brushes.Transparent;

                    lbl_rowNumber.Style      = (Style)Application.Current.Resources["EvaCellDefLabel"];
                    lbl_teamName.Style       = (Style)Application.Current.Resources["EvaCellDefLabel"];
                    lbl_winPoints.Style      = (Style)Application.Current.Resources["EvaCellDefLabel"];
                    lbl_gamePointsDiff.Style = (Style)Application.Current.Resources["EvaCellDefLabel"];

                    lbl_rowNumber.Content      = Convert.ToString(x);
                    lbl_teamName.Content       = team.teamName;
                    lbl_winPoints.Content      = Convert.ToString(team.winPoints);
                    lbl_gamePointsDiff.Content = Convert.ToString(team.gamePointsTotalDiff);

                    lbl_rowNumber.Uid      = Convert.ToString(x);
                    lbl_teamName.Uid       = Convert.ToString(x);
                    lbl_winPoints.Uid      = Convert.ToString(x);
                    lbl_gamePointsDiff.Uid = Convert.ToString(x);

                    lbl_rowNumber.MouseEnter      += new MouseEventHandler(MarkUpActRow);
                    lbl_teamName.MouseEnter       += new MouseEventHandler(MarkUpActRow);
                    lbl_winPoints.MouseEnter      += new MouseEventHandler(MarkUpActRow);
                    lbl_gamePointsDiff.MouseEnter += new MouseEventHandler(MarkUpActRow);
                    lbl_rowNumber.MouseLeave      += new MouseEventHandler(MarkDownActRow);
                    lbl_teamName.MouseLeave       += new MouseEventHandler(MarkDownActRow);
                    lbl_winPoints.MouseLeave      += new MouseEventHandler(MarkDownActRow);
                    lbl_gamePointsDiff.MouseLeave += new MouseEventHandler(MarkDownActRow);

                    btn_teamGameInfo.Uid         = Convert.ToString(team.teamId) + "|" + Convert.ToString(x);
                    btn_teamGameInfo.Content     = "i";
                    btn_teamGameInfo.Height      = 31.28;
                    btn_teamGameInfo.FontWeight  = FontWeights.Bold;
                    btn_teamGameInfo.FontFamily  = new FontFamily("Courier New");
                    btn_teamGameInfo.FontSize    = 16;
                    btn_teamGameInfo.Foreground  = Brushes.WhiteSmoke;
                    btn_teamGameInfo.Style       = (Style)Application.Current.Resources["InfoButton"];
                    btn_teamGameInfo.Click      += new RoutedEventHandler(OpenTeamGameInfo);
                    btn_teamGameInfo.MouseEnter += new MouseEventHandler(MarkUpActRow);
                    btn_teamGameInfo.MouseLeave += new MouseEventHandler(MarkDownActRow);

                    //lbl_rowNumber.FontSize = 16;
                    //lbl_teamName.FontSize = 16;
                    //lbl_winPoints.FontSize = 16;
                    //lbl_gamePointsDiff.FontSize = 16;

                    lbl_rowNumber.HorizontalContentAlignment      = HorizontalAlignment.Right;
                    lbl_teamName.HorizontalContentAlignment       = HorizontalAlignment.Center;
                    lbl_winPoints.HorizontalContentAlignment      = HorizontalAlignment.Center;
                    lbl_gamePointsDiff.HorizontalContentAlignment = HorizontalAlignment.Center;
                    #endregion

                    if (x == last)
                    {
                        lbl_rowNumber.Style      = (Style)Application.Current.Resources["EvaCellFlopsLabel"];
                        lbl_teamName.Style       = (Style)Application.Current.Resources["EvaCellFlopsLabel"];
                        lbl_winPoints.Style      = (Style)Application.Current.Resources["EvaCellFlopsLabel"];
                        lbl_gamePointsDiff.Style = (Style)Application.Current.Resources["EvaCellFlopsLabel"];
                    }

                    if (x >= 1 && x <= 3)
                    {
                        lbl_rowNumber.Style      = (Style)Application.Current.Resources["EvaCellTopsLabel"];
                        lbl_teamName.Style       = (Style)Application.Current.Resources["EvaCellTopsLabel"];
                        lbl_winPoints.Style      = (Style)Application.Current.Resources["EvaCellTopsLabel"];
                        lbl_gamePointsDiff.Style = (Style)Application.Current.Resources["EvaCellTopsLabel"];
                    }

                    tabelLabel[x - 1, 0] = lbl_rowNumber;
                    tabelLabel[x - 1, 1] = lbl_teamName;
                    tabelLabel[x - 1, 2] = lbl_winPoints;
                    tabelLabel[x - 1, 3] = lbl_gamePointsDiff;

                    #region add Button n Lable to Table
                    stp_posNumber.Children.Add(lbl_rowNumber);
                    sep = new Separator();
                    stp_posNumber.Children.Add(sep);

                    stp_TeamName.Children.Add(lbl_teamName);
                    sep = new Separator();
                    stp_TeamName.Children.Add(sep);

                    stp_WinPoints.Children.Add(lbl_winPoints);
                    sep = new Separator();
                    stp_WinPoints.Children.Add(sep);

                    stp_GamePointsDiff.Children.Add(lbl_gamePointsDiff);
                    sep = new Separator();
                    stp_GamePointsDiff.Children.Add(sep);

                    stp_TeamGameInfo.Children.Add(btn_teamGameInfo);
                    sep = new Separator();
                    stp_TeamGameInfo.Children.Add(sep);
                    #endregion
                }
            }
        }
Пример #11
0
        private void PlayedGameInfo_Loaded(object sender, RoutedEventArgs e)
        {
            INIFile teamIni  = new INIFile(Team.iniPath);
            INIFile gameIni  = new INIFile(Game.iniPath);
            INIFile tnmtIni  = new INIFile(Tournament.iniPath);
            INIFile tableIni = new INIFile(Table.iniPath);

            Team reqTeam = new Team();

            reqTeam.Getter(pGWd_reqTeamId);

            Button[] iA_Btns =
            {
                btn_ClosePlayedGameInfo
            };
            Settings.SwitchColorStyleDefaultButton(iA_Btns);

            Const.SwitchColor(this);

            Game playedGame = new Game();

            playedGame.Getter(pGWd_gameId);

            Team team1 = new Team();

            team1.Getter(playedGame.gameTeams[0]);
            Team team2 = new Team();

            team2.Getter(playedGame.gameTeams[1]);

            for (int i = 1; i <= Convert.ToInt32(tableIni.GetValue(Const.fileSec, Table.fsX_tableCnt)); i++)
            {
                Table playedTable = new Table();
                playedTable.Getter(i, pGWd_runId);
                for (int x = 0; x < Convert.ToInt32(tnmtIni.GetValue(Tournament.tnmtSec, Tournament.tnS_tnmtGameProRunCnt)); x++)
                {
                    if (playedTable.tableGameIds[x] == playedGame.gameId)
                    {
                        lbl_oGameInfo.Content = pGWd_runId + ". Durchgang / " + playedGame.gameId + ". Spiel | Tisch-Nr.: " + playedTable.tableId;
                        break;
                    }
                }
            }



            lbl_oTeam1.Content = team1.teamName;
            lbl_oTeam2.Content = team2.teamName;

            lbl_oGamePointsTeam1.Content = Convert.ToString(playedGame.gamePoints[0]);
            lbl_oGamePointsTeam2.Content = Convert.ToString(playedGame.gamePoints[1]);

            lbl_sWinOrLost.Content = reqTeam.teamName;

            if (playedGame.gamePoints[0] < playedGame.gamePoints[1])
            {
                if (reqTeam.teamId == playedGame.gameTeams[0])
                {
                    lbl_sWinOrLost.Content += " hat verloren";
                }
                else
                {
                    lbl_sWinOrLost.Content += " hat gewonnen";
                }
            }
            else
            {
                if (reqTeam.teamId == playedGame.gameTeams[0])
                {
                    lbl_sWinOrLost.Content += " hat gewonnen";
                }
                else
                {
                    lbl_sWinOrLost.Content += " hat verloren";
                }
            }
        }
Пример #12
0
        private void PlayedGameInfo_Loaded(object sender, RoutedEventArgs e)
        {
            INIFile teamIni = new INIFile(Team.iniPath);
            INIFile gameIni = new INIFile(Game.iniPath);
            INIFile tnmtIni = new INIFile(Tournament.iniPath);

            Team reqTeam = new Team();

            reqTeam.Getter(pGWd_reqTeamId);

            Button[] iA_Btns =
            {
                btn_ClosePlayedGameInfo
            };
            Settings.SwitchColorStyleDefaultButton(iA_Btns);

            Const.SwitchColor(this);

            Game playedGame = new Game();

            playedGame.Getter(pGWd_gameId);

            Team team1 = new Team();

            team1.Getter(playedGame.gameTeams[0]);
            Team team2 = new Team();

            team2.Getter(playedGame.gameTeams[1]);

            lbl_oGameInfo.Content = pGWd_runId + ". Durchgang / " + playedGame.gameId + ". Spiel";

            lbl_oTeam1.Content = team1.teamName;
            lbl_oTeam2.Content = team2.teamName;

            lbl_oGamePointsTeam1.Content = Convert.ToString(playedGame.gamePoints[0]);
            lbl_oGamePointsTeam2.Content = Convert.ToString(playedGame.gamePoints[1]);

            lbl_sWinOrLost.Content = reqTeam.teamName;

            if (playedGame.gamePoints[0] < playedGame.gamePoints[1])
            {
                if (reqTeam.teamId == playedGame.gameTeams[0])
                {
                    lbl_sWinOrLost.Content += " hat verloren";
                }
                else
                {
                    lbl_sWinOrLost.Content += " hat gewonnen";
                }
            }
            else
            {
                if (reqTeam.teamId == playedGame.gameTeams[0])
                {
                    lbl_sWinOrLost.Content += " hat gewonnen";
                }
                else
                {
                    lbl_sWinOrLost.Content += " hat verloren";
                }
            }
        }