Exemple #1
0
        public void UninstallGame(Game game)
        {
            ConfirmationWindow confirm = new ConfirmationWindow();

            confirm.ShowDialog();

            if (confirm.value)
            {
                string _path = appPath + game.path;

                if (Directory.Exists(_path))
                {
                    Directory.Delete(_path, true);
                }

                RefreshGamesDisplay();
            }
        }
Exemple #2
0
        private void BuyButton_Click(object sender, RoutedEventArgs e)
        {
            ConfirmationWindow confirmation = new ConfirmationWindow();

            confirmation.ShowDialog();

            if (confirmation.value == false)
            {
                return;
            }

            string response = client.RequestBuyGame(actualGameSelected.id);

            if (response == "OK")
            {
                Debug.Log("Game bought!");

                App.library.NewGameBought(actualGameSelected.id);

                CoinsNumberText.Text = Library.userInfo.coins.ToString();
                if (CoinsNumberText.Text == "Free")
                {
                    CoinsNumberText.Text = "0";
                }

                GetGamesList(true);


                RefreshGamesDisplay();


                if (games.Count > 0)
                {
                    actualGameSelected = games[0];
                    DisplayGameInfo(actualGameSelected);
                }
                else
                {
                    DisplayNoGamesInfo();
                }
            }
            else
            {
                //Debug.Log("Something went wrong, response: " + response);
                if (response == "TP")
                {
                    MessageBox.Show("Not enough coins to buy this game", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (response == "NA")
                {
                    MessageBox.Show("Session expired, try restarting app", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (response == "NF")
                {
                    MessageBox.Show("Game not found on server, are You doing somethig sketchy???", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (response == "AB")
                {
                    MessageBox.Show("Are you trying to buy this game again? NO! You won't spend money on something You have", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }