Ejemplo n.º 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
                        );
                }
            }
        }
Ejemplo n.º 2
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 if (column_index <= 2)
            {
                GUIMod gui_mod = row?.Tag as GUIMod;
                if (gui_mod != null)
                {
                    switch (column_index)
                    {
                    case 0:
                        gui_mod.SetInstallChecked(row);
                        if (gui_mod.IsInstallChecked)
                        {
                            last_mod_to_have_install_toggled.Push(gui_mod);
                        }
                        break;

                    case 1:
                        gui_mod.SetUpgradeChecked(row);
                        break;

                    case 2:
                        gui_mod.SetReplaceChecked(row);
                        break;
                    }
                    await UpdateChangeSetAndConflicts(
                        RegistryManager.Instance(CurrentInstance).registry
                        );
                }
            }
        }
Ejemplo n.º 3
0
 private void ClearChangeSet()
 {
     foreach (DataGridViewRow row in mainModList.full_list_of_mod_rows.Values)
     {
         GUIMod mod = row.Tag as GUIMod;
         if (mod.IsInstallChecked != mod.IsInstalled)
         {
             mod.SetInstallChecked(row, Installed, mod.IsInstalled);
         }
         mod.SetUpgradeChecked(row, UpdateCol, false);
         mod.SetReplaceChecked(row, ReplaceCol, false);
     }
 }