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
     }
 }
示例#2
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
        }
    }