private void AddGame_Click(object sender, EventArgs e)
        {
            AddGame game = new AddGame(maindev.Код_разработчика);

            game.ShowDialog();
            ShowGames_Click(sender, e);
        }
 public AddEditPage2(AddGame addGame)
 {
     InitializeComponent();
     AddGame   = addGame;       // Set
     isFromAdd = true;
     Platforms = new();
     Stores    = new();
     RAWGID    = AddGame.RAWGID;
 }
Beispiel #3
0
 public MainWindow()
 {
     InitializeComponent();
     Directory.CreateDirectory("Icons");
     _library = new Library(contentControl);
     _addGame = new AddGame(contentControl, _library);
     contentControl.Content = _library;
     versionText.Text       = GameVersion.CurrentVersion;
     Title = "TeknoParrot UI " + GameVersion.CurrentVersion;
 }
Beispiel #4
0
 private void CancelBtn_Click(object sender, RoutedEventArgs e)
 {
     if (isFromAdd)
     {
         AddGame.Close();
     }
     else
     {
         EditGame.Close();
     }
 }
 private void BackBtn_Click(object sender, RoutedEventArgs e)
 {
     if (isFromAdd)
     {
         AddGame.ChangePage(0);             // Go back to last page
     }
     else
     {
         EditGame.ChangePage(0);             // Go back to last page
     }
 }
Beispiel #6
0
        private void Upload(string league, DateTime koDate, string homeTeam, string awayTeam, IEnumerable <XElement> snaps)
        {
            int leagueId = addLeague(league);

            int hTeamId = AddTeam.DoIt(dbStuff, homeTeam);
            int aTeamId = AddTeam.DoIt(dbStuff, awayTeam);
            int gameId  = AddGame.DoIt(dbStuff, hTeamId, aTeamId, leagueId, koDate);

            log.Debug("Adding " + homeTeam + " [" + hTeamId + "] v " + awayTeam + " [" + aTeamId + "] in league [" + leagueId + "] with game id: " + gameId);
            SendStats(snaps, gameId);
        }
    private void NextBtn_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            if (isFromAdd)
            {
                Definitions.Games.Add(new()
                {
                    Name             = AddGame.GameName,         // Set value
                    Version          = AddGame.GameVersion,      // Set value
                    Description      = DescriptionTextBox.Text,  // Set value
                    FileLocation     = AddGame.GameLocation,     // Set value
                    IconFileLocation = AddGame.GameIconLocation, // Set value
                    IsFavorite       = false,                    // Set value
                    RAWGID           = RAWGID,                   // Set value
                    LastTimePlayed   = 0,                        // Set value
                    TotalTimePlayed  = 0,                        // Set value
                    ProcessName      = "",                       // Set value
                    Platforms        = (Platforms.Count == 0) ? new List <SDK.RAWG.Platform> {
                        Definitions.DefaultPlatform
                    } : Platforms,                                                                                                                    // Get platforms
                    Stores = Stores,
                    AlwaysCheckIfRunning = false,
                    IsUWP   = AddGame.IsUWP,
                    IsSteam = AddGame.IsSteam
                });

                GameSaver.Save(Definitions.Games);       // Save
                Global.ReloadAllPages();                 // Refresh UI

                AddGame.Close();
            }
            else
            {
                GameCard.GameInfo.RAWGID      = RAWGID;                                // Set
                GameCard.GameInfo.Description = DescriptionTextBox.Text;               // Set
                GameCard.GameInfo.Platforms   = Platforms;                             // Set
                GameCard.GameInfo.Stores      = Stores;                                // Set

                Definitions.Games[Definitions.Games.IndexOf(old)] = GameCard.GameInfo; // Update
                GameSaver.Save(Definitions.Games);                                     // Save

                Global.ReloadAllPages();                                               // Refresh UI

                EditGame.Close();
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, Properties.Resources.MainWindowTitle, MessageBoxButton.OK, MessageBoxImage.Error);
        }
    }
Beispiel #8
0
    public AddEditPage(AddGame addGame)
    {
        InitializeComponent();
        AddGame   = addGame;                                                                      // Set
        isFromAdd = true;                                                                         // Set
        isUWP     = addGame.IsUWP;                                                                // Set
        isSteam   = addGame.IsSteam;                                                              // Set
        RAWGID    = -1;                                                                           // -1 => Default value, no assigned RAWG ID.

        DragWin32Games.Visibility = isUWP || isSteam ? Visibility.Collapsed : Visibility.Visible; // Set visibility
        UWPGames.Visibility       = !isUWP ? Visibility.Collapsed : Visibility.Visible;           // Set visibility
        SteamGameInfo.Visibility  = !isSteam ? Visibility.Collapsed : Visibility.Visible;         // Set visibility
    }
Beispiel #9
0
        public void OpenAddGameForm()
        {
            _addGame = new AddGame(this);

            List <City> cities = _cityRepository.GetCities().ToList();

            foreach (City city in cities)
            {
                _addGame.CityComboBox.Items.Add(new ComboBoxItem {
                    Content = city.Name, Tag = city.Id
                });
            }
            _addGame.CityComboBox.SelectedIndex = 0;

            List <Team> teams = _teamRepository.GetTeams().ToList();

            foreach (Team team in teams)
            {
                _addGame.HomeTeamComboBox.Items.Add(new ComboBoxItem {
                    Content = team.Name, Tag = team.Id
                });
                _addGame.AwayTeamComboBox.Items.Add(new ComboBoxItem {
                    Content = team.Name, Tag = team.Id
                });
            }
            _addGame.HomeTeamComboBox.SelectedIndex = 0;
            _addGame.AwayTeamComboBox.SelectedIndex = 0;

            List <Licence> licences = _licenceRepository.GetLicences().ToList();

            foreach (Licence licence in licences)
            {
                _addGame.LicenceComboBox.Items.Add(new ComboBoxItem {
                    Content = licence.Name + " prioritet: " + licence.Priority, Tag = licence.Id
                });
            }
            _addGame.LicenceComboBox.SelectedIndex = 0;

            List <Referee> referees = _refereeRepository.GetReferees().ToList();

            foreach (Referee referee in referees)
            {
                _addGame.RefereeComboBox.Items.Add(new ComboBoxItem {
                    Content = referee.FirstName + " " + referee.LastName, Tag = referee.Id
                });
            }

            _addGame.DatePicker.SelectedDate = DateTime.Now;

            _addGame.Show();
        }
Beispiel #10
0
 private void AddGame_Click(object sender, EventArgs e)
 {
     if (databasevalue == "developers")
     {
         DataGridViewSelectedRowCollection Datalist = Database.SelectedRows;
         AddGame game = new AddGame(Datalist);
         game.ShowDialog();
         ShowGames_Click(sender, e);
     }
     else
     {
         MessageBox.Show("Выберите разработчика для добавления игры");
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            Directory.CreateDirectory("Icons");
            _library = new Library(contentControl);
            _addGame = new AddGame(contentControl, _library);
            contentControl.Content = _library;
            versionText.Text       = GameVersion.CurrentVersion;
            Title = "TeknoParrot UI " + GameVersion.CurrentVersion;

            SaveCompleteSnackbar.VerticalAlignment          = VerticalAlignment.Top;
            SaveCompleteSnackbar.HorizontalContentAlignment = HorizontalAlignment.Center;
            // 2 seconds
            SaveCompleteSnackbar.MessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(2000));
        }
Beispiel #12
0
        private void GamesAdd_Click(object sender, RoutedEventArgs e)
        {
            if (App.DataMan.Emulators.Count < 1)
            {
                MessageBox.Show("No emulators are set. Please setup at least one emulator to add games", "No Emulators", MessageBoxButton.OK, MessageBoxImage.Warning);
                Dispatcher.Invoke(() => { MainTabs.SelectedIndex = 1; });
                return;
            }
            var add = new AddGame(DialogContainer);

            add.OkAction = new System.Action(() =>
            {
                App.DataMan.AddGames(add.Items);
            });
            OpenDialog(add, "Add games...");
        }
        private void button3_Click(object sender, EventArgs e)
        {
            string gameName  = round1.Text;
            int    gameCount = Int16.Parse(round2.Text);
            double gamePrice = Double.Parse(round3.Text);
            string platform  = "";

            byte[] gameimages = null;


            FileStream   stream = new FileStream(imgLocation, FileMode.Open, FileAccess.Read);
            BinaryReader brs    = new BinaryReader(stream);

            gameimages = brs.ReadBytes((int)stream.Length);



            if (radioButton1.Checked)
            {
                platform = "PC";
            }
            else if (radioButton2.Checked)
            {
                platform = "PS4";
            }
            else if (radioButton3.Checked)
            {
                platform = "XBOX";
            }
            else
            {
                MessageBox.Show("Enter Game Platform");
            }
            string  rating  = round4.Text;
            AddGame addGame = new AddGame();

            addGame.addGame(gameName, gamePrice, gameCount, platform, rating, gameimages);
        }
Beispiel #14
0
        protected void SendToWeb(string league, DateTime koDate, string homeTeam, string awayTeam, Dictionary <string, int> hstats, Dictionary <string, int> astats, string time)
        {
            int leagueId = addLeague(league);
            int hTeamId  = AddTeam.DoIt(dbStuff, homeTeam);
            int aTeamId  = AddTeam.DoIt(dbStuff, awayTeam);
            int gameId   = AddGame.DoIt(dbStuff, hTeamId, aTeamId, leagueId, koDate);

            List <int> allStats = new List <int>();

            allStats.AddRange(hstats.Values);
            allStats.AddRange(astats.Values);

            int retries = 0;

            log.Debug("Adding " + homeTeam + " [" + hTeamId + "] v " + awayTeam + " [" + aTeamId + "] in league [" + leagueId + "] with game id: " + gameId + " at time: " + time);

            log.Debug("Goals Corners");

            var line1 = hstats[statType[1]].ToString().PadRight(6) + hstats[statType[6]].ToString();
            var line2 = astats[statType[1]].ToString().PadRight(6) + astats[statType[6]].ToString();

            log.Debug(line1);
            log.Debug(line2);

            while (retries < keyClashRetries)
            {
                try
                {
                    AddStatistics.DoIt(dbStuff, isBet365(), allStats, gameId, time, "", koDate);
                }
                catch (DbException)
                {
                    log.Warn("Retrying....");
                    retries += 1;
                }
                break;
            }
        }
Beispiel #15
0
        public void AddTodaysMatches(int sleepTime, DriverWrapper driver)
        {
            var foundMatches = new List <aMatch>();

            driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";

            driver.ForceSleep(sleepTime);
            driver.GetElementAndClick("splashSection", "MATCH MARKETS");
            driver.ForceSleep(sleepTime);
            driver.GetElementAndClick("splashSection", "Main");
            driver.ForceSleep(sleepTime);
            driver.GetElementAndClick("genericRow", "Full Time Result");
            driver.ForceSleep(sleepTime);

            // it takes time for genericRow to expand
            GetPreMatchData(driver, foundMatches);
            /////////////////////

            int longestTeam1  = foundMatches.Select(x => x.team1).Max(x => x.Length);
            int longestTeam2  = foundMatches.Select(x => x.team2).Max(x => x.Length);
            int longestLeague = foundMatches.Select(x => x.league).Max(x => x.Length);

            foreach (aMatch m in foundMatches)
            {
                Console.WriteLine(m.team1.PadRight(longestTeam1 + 1) + " " + m.team2.PadRight(longestTeam2 + 1) + " at " + m.koDateTime.TimeOfDay + " in " + m.league);

                int leagueId = AddLeague.DoIt(m_dbStuff, m.league);
                int hTeamId  = AddTeam.DoIt(m_dbStuff, m.team1);
                int aTeamId  = AddTeam.DoIt(m_dbStuff, m.team2);
                int gameId   = AddGame.DoIt(m_dbStuff, hTeamId, aTeamId, leagueId, m.koDateTime);
                m.id = gameId;
            }

            /////////////////////

            driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";
            driver.ForceSleep(sleepTime);

            driver.GetElementAndClick("splashSection", "CORNERS");
            driver.ForceSleep(sleepTime);

            //driver.GetElementAndClick("genericRow", "Race To 3 Corners");
            //driver.ForceSleep(sleepTime);

            //GetRaceToCornerData(driver, foundMatches, 3);

            ///////////////////////

            //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";

            //driver.ForceSleep(sleepTime);
            //driver.GetElementAndClick("genericRow", "Race To 5 Corners");
            //driver.ForceSleep(sleepTime);

            //GetRaceToCornerData(driver, foundMatches, 5);

            ///////////////////////

            //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";

            //driver.ForceSleep(sleepTime);
            //driver.GetElementAndClick("genericRow", "Race To 7 Corners");
            //driver.ForceSleep(sleepTime);

            //GetRaceToCornerData(driver, foundMatches, 7);

            ///////////////////////

            //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";

            //driver.ForceSleep(sleepTime);
            //driver.GetElementAndClick("genericRow", "Race To 9 Corners");
            //driver.ForceSleep(sleepTime);

            //GetRaceToCornerData(driver, foundMatches, 9);
            /////////////////////

            //driver.Url = "https://mobile.bet365.com/premium/#type=Splash;key=1;ip=0;lng=1";
            //driver.ForceSleep(sleepTime);

            driver.GetElementAndClick("genericRow", "Asian Total Corners");

            System.Threading.Thread.Sleep(sleepTime);
            driver.ForceSleep(sleepTime);

            GetAsianCornerData(driver, foundMatches);

            /////////////////////

            foreach (aMatch m in foundMatches)
            {
                Console.WriteLine(m.team1.PadRight(longestTeam1 + 1) + " " + m.team2.PadRight(longestTeam2 + 1) + " corner line: " + m.cornerLine + " " + m.homeAsianCornerPrice + "//" + m.awayAsianCornerPrice);

                if (String.IsNullOrEmpty(m.cornerLine) == false)
                {
                    AddCornerData.DoIt(m_dbStuff, m.id, m.cornerLine, m.homeAsianCornerPrice, m.awayAsianCornerPrice);
                }

                if (String.IsNullOrEmpty(m.homeRaceTo3CornersPrice) == false &&
                    String.IsNullOrEmpty(m.awayRaceTo3CornersPrice) == false &&
                    String.IsNullOrEmpty(m.neitherRaceTo3CornersPrice) == false)
                {
                    AddRaceToCornerData.DoIt(m_dbStuff, m.id, 3, m.homeRaceTo3CornersPrice, m.awayRaceTo3CornersPrice, m.neitherRaceTo3CornersPrice);
                }

                if (String.IsNullOrEmpty(m.homeRaceTo5CornersPrice) == false &&
                    String.IsNullOrEmpty(m.awayRaceTo5CornersPrice) == false &&
                    String.IsNullOrEmpty(m.neitherRaceTo5CornersPrice) == false)
                {
                    AddRaceToCornerData.DoIt(m_dbStuff, m.id, 5, m.homeRaceTo5CornersPrice, m.awayRaceTo5CornersPrice, m.neitherRaceTo5CornersPrice);
                }

                if (String.IsNullOrEmpty(m.homeRaceTo7CornersPrice) == false &&
                    String.IsNullOrEmpty(m.awayRaceTo7CornersPrice) == false &&
                    String.IsNullOrEmpty(m.neitherRaceTo7CornersPrice) == false)
                {
                    AddRaceToCornerData.DoIt(m_dbStuff, m.id, 7, m.homeRaceTo7CornersPrice, m.awayRaceTo7CornersPrice, m.neitherRaceTo7CornersPrice);
                }

                if (String.IsNullOrEmpty(m.homeRaceTo9CornersPrice) == false &&
                    String.IsNullOrEmpty(m.awayRaceTo9CornersPrice) == false &&
                    String.IsNullOrEmpty(m.neitherRaceTo9CornersPrice) == false)
                {
                    AddRaceToCornerData.DoIt(m_dbStuff, m.id, 9, m.homeRaceTo9CornersPrice, m.awayRaceTo9CornersPrice, m.neitherRaceTo9CornersPrice);
                }

                if (String.IsNullOrEmpty(m.homeWinPrice) == false &&
                    String.IsNullOrEmpty(m.drawPrice) == false &&
                    String.IsNullOrEmpty(m.awayWinPrice) == false)
                {
                    AddFinalResultPrices.DoIt(m_dbStuff, m.id, m.homeWinPrice, m.drawPrice, m.awayWinPrice);
                }
            }
            ///////////////////////

            Console.WriteLine("Finished");
        }
Beispiel #16
0
        public IActionResult AddGame()
        {
            var model = new AddGame();

            return(View(model));
        }
Beispiel #17
0
    private void NextBtn_Click(object sender, RoutedEventArgs e)
    {
        if (isUWP)
        {
            if (string.IsNullOrEmpty(PackageFamilyNameTextBox.Text) || string.IsNullOrEmpty(AppIdTextBox.Text))
            {
                MessageBox.Show(Properties.Resources.GameNeedsName, Properties.Resources.AddGame, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;                 // Stop
            }
        }
        else if (isSteam)
        {
            if (string.IsNullOrEmpty(NameTextBox.Text) || string.IsNullOrEmpty(SteamAppIdTextBox.Text))
            {
                MessageBox.Show(Properties.Resources.GameNeedsName, Properties.Resources.AddGame, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;                 // Stop
            }
        }
        else
        {
            if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LocationTxt.Text))
            {
                // OK
            }
            else
            {
                MessageBox.Show(Properties.Resources.GameNeedsName, Properties.Resources.AddGame, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;                 // Stop
            }
        }

        if (isFromAdd)
        {
            AddGame.RAWGID      = RAWGID;              // Set
            AddGame.GameVersion = VersionTextBox.Text; // Set
            AddGame.GameName    = NameTextBox.Text;    // Set
            if (isUWP)
            {
                AddGame.GameLocation = $@"shell:appsFolder\{PackageFamilyNameTextBox.Text}!{AppIdTextBox.Text}";                 // Set
            }
            else if (isSteam)
            {
                AddGame.GameLocation = $"steam://rungameid/{SteamAppIdTextBox.Text}";                 // Set
            }
            else
            {
                AddGame.GameLocation = GameLocation;                 // Set
            }


            AddGame.GameIconLocation = GameIconLocation; // Set
            AddGame.ChangePage(1);                       // Change page
        }
        else
        {
            GameCard.GameInfo.Name             = NameTextBox.Text;    // Set
            GameCard.GameInfo.Version          = VersionTextBox.Text; // Set
            GameCard.GameInfo.IconFileLocation = GameIconLocation;    // Set

            if (isUWP)
            {
                GameCard.GameInfo.FileLocation = $@"shell:appsFolder\{PackageFamilyNameTextBox.Text}!{AppIdTextBox.Text}";                 // Set
            }
            else if (isSteam)
            {
                GameCard.GameInfo.FileLocation = $"steam://rungameid/{SteamAppIdTextBox.Text}";                 // Set
            }
            else
            {
                GameCard.GameInfo.FileLocation = LocationTxt.Text;                 // Set
            }

            EditGame.GameCard = GameCard;       // Set

            EditGame.ChangePage(1);             // Change page
        }
    }
Beispiel #18
0
 public static void OnAddGame(object sender)
 => AddGame?.Invoke(sender, EventArgs.Empty);