예제 #1
0
        private async void ModList_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int row_index    = e.RowIndex;
            int column_index = e.ColumnIndex;

            if (row_index < 0 || column_index < 0)
            {
                return;
            }

            DataGridView     grid     = sender as DataGridView;
            DataGridViewRow  row      = grid?.Rows[row_index];
            DataGridViewCell gridCell = row?.Cells[column_index];

            if (gridCell is DataGridViewLinkCell)
            {
                // Launch URLs if found in grid
                DataGridViewLinkCell cell = gridCell as DataGridViewLinkCell;
                string cmd = cell?.Value.ToString();
                if (!string.IsNullOrEmpty(cmd))
                {
                    Process.Start(cmd);
                }
            }
            else
            {
                GUIMod gui_mod = row?.Tag as GUIMod;
                if (gui_mod != null)
                {
                    switch (ModList.Columns[column_index].Name)
                    {
                    case "Installed":
                        gui_mod.SetInstallChecked(row, Installed);
                        if (gui_mod.IsInstallChecked)
                        {
                            last_mod_to_have_install_toggled.Push(gui_mod);
                        }
                        // The above will call UpdateChangeSetAndConflicts, so we don't need to.
                        return;

                    case "AutoInstalled":
                        gui_mod.SetAutoInstallChecked(row, AutoInstalled);
                        needRegistrySave = true;
                        break;

                    case "UpdateCol":
                        gui_mod.SetUpgradeChecked(row, UpdateCol);
                        break;

                    case "ReplaceCol":
                        gui_mod.SetReplaceChecked(row, ReplaceCol);
                        break;
                    }
                    await UpdateChangeSetAndConflicts(
                        RegistryManager.Instance(CurrentInstance).registry
                        );
                }
            }
        }