예제 #1
0
 private void RemoveFavoriteButton(object sender, EventArgs e)
 {
     if (_selectedFavoriteProcess == null || !Favorites.CanRemove(_selectedFavoriteProcess))
     {
         MessageBox.Show("Unable to remove " + _selectedFavoriteProcess + " does not exist!", "Uh oh!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Favorites.Remove("./Favorites.json", _selectedFavoriteProcess);
         favoritesList.DataSource = null;
         favoritesList.DataSource = Favorites.List;
     }
 }
예제 #2
0
 private void SendToFavorites(object sender, EventArgs e)
 {
     if (_selectedProcessName == null || !Favorites.CanAdd(_selectedProcessName))
     {
         MessageBox.Show("Unable to add " + _selectedProcessName + " already added!", "Uh oh!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Favorites.AddGame(_selectedProcessName);
         Favorites.Save("./Favorites.json");
         favoritesList.DataSource = null;
         favoritesList.DataSource = Favorites.List;
         MessageBox.Show(_selectedProcessName + " added to favorites", "Victory!",
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }