コード例 #1
0
 private void BtnAddGame_Click(object sender, EventArgs e)
 {
     Logger.Trace($"{nameof(BtnAddGame_Click)}(..., ...);");
     using (var dialog = new AddGameDialog())
     {
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             Configuration.Games.GamesToAdd = Configuration.Games.GamesToAdd.Append(dialog.GameInfo);
             ListGames.UpdateItems(Configuration.Games.GamesToAdd);
             Logger.Debug($"{dialog.GameInfo.SubId}:{dialog.GameInfo.Name} added.");
         }
     }
 }
コード例 #2
0
        private void ListGames_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Logger.Trace($"{nameof(ListGames_MouseDoubleClick)}(..., ...);");
            var index = ListGames.SelectedIndex;

            if (index < 0 || index >= ListGames.Items.Count)
            {
                return;
            }

            var game = ListGames.Items[index] as Models.GameInfo;

            using (var dialog = new AddGameDialog(game))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var _temp = Configuration.Games.GamesToAdd.ToList();
                    ListGames.Items[index]         = _temp[index] = game;
                    Configuration.Games.GamesToAdd = _temp;
                    Logger.Debug($"{game.SubId}:{game.Name} edited.");
                }
            }
        }