Пример #1
0
 public MainWindow()
 {
     game = new Game();
     InitializeComponent();
     DBwork.LoadPlayers();
     DBwork.LoadSettings();
 }
Пример #2
0
 private void EndGame()                                                             //  Конец матча
 {
     IsOn = false;                                                                  //  Флаг матча
     //  Сообщение
     WinnerWindowLogic.ShowWinner(playerOnThrow, player1, player2, allMatchThrows); //  Показываем окно победителя и статистику
     //  Панели
     mainWindow.PlayerTab.IsEnabled = true;
     infoPanelLogic.PanelHide();     //  Прячем инфопанель
     BoardPanelLogic.PanelHide();    //  Прячем панель секторов
     settingsPanelLogic.PanelShow(); //  Показываем панель настроек
     //  Сохранение в БД
     DBwork.AfterMatchSave(statisticsWindowLogic);
     DBwork.UpdateAchieves(statisticsWindowLogic);
     //  Обнуление коллекций
     ClearCollections(); //  Зануляем коллекции бросков
 }
Пример #3
0
        private void MainWindow_Closing(object sender, CancelEventArgs e) //  Выход из приложения
        {
            FadeIn();
            var window = new Windows.ExitWindow {
                Owner = this
            };

            window.ShowDialog();
            if (window.result)   //  Если нажата отмена выхода
            {
                e.Cancel = true; //  Остаемся
            }
            else // Если выходим
            {
                DBwork.SaveSettings(); //  Сохраняем настройки
            }

            FadeOut();
        }
Пример #4
0
        public static void RefreshPvP(int player1Id, int player2Id)
        {
            var arr = DBwork.FindPvP(player1Id, player2Id);

            MainWindow.TabPvPGames.Content        = arr[0];
            MainWindow.TabPlayer1PvPGames.Content = arr[1];
            MainWindow.TabPlayer2PvPGames.Content = arr[2];
            MainWindow.TabPvPGamesSlider.Fill     = Brush(arr[1], arr[2]);

            MainWindow.TabPvPLegs.Content        = arr[3];
            MainWindow.TabPlayer1PvPLegs.Content = arr[4];
            MainWindow.TabPlayer2PvPLegs.Content = arr[5];
            MainWindow.TabPvPLegsSlider.Fill     = Brush(arr[4], arr[5]);

            MainWindow.TabPvPSets.Content        = arr[6];
            MainWindow.TabPlayer1PvPSets.Content = arr[7];
            MainWindow.TabPlayer2PvPSets.Content = arr[8];
            MainWindow.TabPvPSetsSlider.Fill     = Brush(arr[7], arr[8]);

            MainWindow.TabPvPNumberOfThrows.Content   = arr[9];
            MainWindow.TabPvPPlayer1Throws.Content    = arr[10];
            MainWindow.TabPvPPlayer2Throws.Content    = arr[11];
            MainWindow.TabPvPPlayersThrowsSlider.Fill = Brush(arr[10], arr[11]);

            MainWindow.TabPvPNumberOfPoints.Content   = arr[12];
            MainWindow.TabPvPPlayer1Points.Content    = arr[13];
            MainWindow.TabPvPPlayer2Points.Content    = arr[14];
            MainWindow.TabPvPPlayersPointsSlider.Fill = Brush(arr[13], arr[14]);

            MainWindow.TabPvP180.Content        = arr[15];
            MainWindow.TabPlayer1PvP180.Content = arr[16];
            MainWindow.TabPlayer2PvP180.Content = arr[17];
            MainWindow.TabPvP180Slider.Fill     = Brush(arr[16], arr[17]);

            MainWindow.TabPvPTrembleThrows.Content        = arr[18];
            MainWindow.TabPlayer1PvPTrembleThrows.Content = arr[19];
            MainWindow.TabPlayer2PvPTrembleThrows.Content = arr[20];
            MainWindow.TabPvPTrembleThrowsSlider.Fill     = Brush(arr[19], arr[20]);

            MainWindow.TabPvPBulleyethrows.Content        = arr[21];
            MainWindow.TabPlayer1PvPBullEyeThrows.Content = arr[22];
            MainWindow.TabPlayer2PvPBullEyeThrows.Content = arr[23];
            MainWindow.TabPvPBulleyeThrowsSlider.Fill     = Brush(arr[22], arr[23]);

            MainWindow.TabPvPDoubleThrows.Content        = arr[24];
            MainWindow.TabPvPPlayer1DoubleThrows.Content = arr[25];
            MainWindow.TabPvPPlayer2DoubleThrows.Content = arr[26];
            MainWindow.TabPvPDoubleThrowsSlider.Fill     = Brush(arr[25], arr[26]);

            MainWindow.TabPvP25Throws.Content        = arr[27];
            MainWindow.TabPlayer1PvP25Throws.Content = arr[28];
            MainWindow.TabPlayer2PvP25Throws.Content = arr[29];
            MainWindow.TabPvP25ThrowsSlider.Fill     = Brush(arr[28], arr[29]);

            MainWindow.TabPvPSingleThrows.Content        = arr[30];
            MainWindow.TabPlayer1PvPSingleThrows.Content = arr[31];
            MainWindow.TabPlayer2PvPSingleThrows.Content = arr[32];
            MainWindow.TabPvPSingleThrowsSlider.Fill     = Brush(arr[31], arr[32]);

            MainWindow.TabPvPZeroThrows.Content        = arr[33];
            MainWindow.TabPlayer1PvPZeroThrows.Content = arr[34];
            MainWindow.TabPlayer2PvPZeroThrows.Content = arr[35];
            MainWindow.TabPvPZeroThrowsSlider.Fill     = Brush(arr[34], arr[35]);

            MainWindow.TabPvPFaultThrows.Content        = arr[36];
            MainWindow.TabPlayer1PvPFaultThrows.Content = arr[37];
            MainWindow.TabPlayer2PvPFaultThrows.Content = arr[38];
            MainWindow.TabPvPFaultThrowsSlider.Fill     = Brush(arr[37], arr[38]);
        }
Пример #5
0
        public static void RefreshPlayer2(int playerId) //  Обновить данные игрока 2
        {
            using (var playerData = DBwork.LoadPlayerData(playerId))
            {
                MainWindow.TabPlayer2GamesPlayed.Content       = (int)playerData.Rows[0][4];
                MainWindow.TabPlayer2GamesWon.Content          = (int)playerData.Rows[0][5];
                MainWindow.TabPlayer2SetsPlayed.Content        = (int)playerData.Rows[0][7];
                MainWindow.TabPlayer2SetsWon.Content           = (int)playerData.Rows[0][8];
                MainWindow.TabPlayer2LegsPlayed.Content        = (int)playerData.Rows[0][9];
                MainWindow.TabPlayer2LegsWon.Content           = (int)playerData.Rows[0][10];
                MainWindow.TabPlayer2Throws.Content            = (int)playerData.Rows[0][11];
                MainWindow.TabPlayer2Points.Content            = (int)playerData.Rows[0][12];
                MainWindow.TabPlayer2AveragePoints.Content     = Math.Round((double)playerData.Rows[0][13], 2);
                MainWindow.TabPlayer2AverageHandPoints.Content = Math.Round((double)playerData.Rows[0][14], 2);
                MainWindow.TabPlayer2BestHand.Content          = Math.Round((double)playerData.Rows[0][15], 2);
                MainWindow.TabPlayer2_180.Content         = (int)playerData.Rows[0][16];
                MainWindow.TabPlayer2TrembleThrow.Content = (int)playerData.Rows[0][17];
                MainWindow.TabPlayer2BulleyeThrow.Content = (int)playerData.Rows[0][18];
                MainWindow.TabPlayer2DoubleThrow.Content  = (int)playerData.Rows[0][19];
                MainWindow.TabPlayer2SingleThrow.Content  = (int)playerData.Rows[0][20];
                MainWindow.TabPlayer2_25Throw.Content     = (int)playerData.Rows[0][21];
                MainWindow.TabPlayer2ZeroThrow.Content    = (int)playerData.Rows[0][22];
                MainWindow.TabPlayer2FaultThrows.Content  = (int)playerData.Rows[0][23];
                DrawSliders();
                if ((bool)playerData.Rows[0][24])
                {
                    MainWindow.AchievePlayer210MatchesLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][25])
                {
                    MainWindow.AchievePlayer2100MatchesLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][26])
                {
                    MainWindow.AchievePlayer21000MatchesLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][27])
                {
                    MainWindow.AchievePlayer210WinLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][28])
                {
                    MainWindow.AchievePlayer2100WinLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][29])
                {
                    MainWindow.AchievePlayer21000WinLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][30])
                {
                    MainWindow.AchievePlayer21000ThrowsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][31])
                {
                    MainWindow.AchievePlayer210000ThrowsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][32])
                {
                    MainWindow.AchievePlayer2100000ThrowsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][33])
                {
                    MainWindow.AchievePlayer210000PointsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][34])
                {
                    MainWindow.AchievePlayer2100000PointsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][35])
                {
                    MainWindow.AchievePlayer21000000PointsLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][36])
                {
                    MainWindow.AchievePlayer2180x10Light.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][37])
                {
                    MainWindow.AchievePlayer2180x100Light.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][38])
                {
                    MainWindow.AchievePlayer2180x1000Light.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][39])
                {
                    MainWindow.AchievePlayer2First180Light.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][40])
                {
                    MainWindow.AchievePlayer23BullLight.Visibility = Visibility.Visible;
                }

                if ((bool)playerData.Rows[0][41])
                {
                    MainWindow.AchievePlayer2mrZLight.Visibility = Visibility.Visible;
                }
            }
        }