Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk selection features added. #1383

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions GUI/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions GUI/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,44 @@ private void FocusMod(string key, bool exactMatch)
this.AddStatusMessage("Not found");
}
}

private void selectAllInstalledModsToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (InstalledModule installedMod in CurrentInstance.Registry.InstalledModules)
{
MarkModForInstall(installedMod.identifier, false);
}
ModList.Refresh();
}

private void deselectAllSelectedModsToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in ModList.Rows)
{
var mod = ((GUIMod)row.Tag);
if (row.Cells[0] is DataGridViewCheckBoxCell && (bool)row.Cells[0].Value)
{
MarkModForInstall(mod.Identifier, (bool)row.Cells[0].Value);
//ApplyToolButton.Enabled = true;
}
}
ApplyToolButton.Enabled = (ChangeSet.Any());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got an exception in this line: (Changeset was null)

An unhandled exception of type 'System.ArgumentNullException' occurred in System.Core.dll

Additional information: Der Wert darf nicht NULL sein.
   bei System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   bei CKAN.Main.deselectAllSelectedModsToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\Martin\Documents\Visual Studio 2015\Projects\CKAN\GUI\Main.cs:Zeile 1066.
   bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
   bei System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   bei CKAN.Main..ctor(String[] cmdlineArgs, GUIUser User, Boolean showConsole) in C:\Users\Martin\Documents\Visual Studio 2015\Projects\CKAN\GUI\Main.cs:Zeile 223.
   bei CKAN.GUI.Main_(String[] args, Boolean showConsole) in C:\Users\Martin\Documents\Visual Studio 2015\Projects\CKAN\GUI\Program.cs:Zeile 35.
   bei CKAN.GUI.Main(String[] args) in C:\Users\Martin\Documents\Visual Studio 2015\Projects\CKAN\GUI\Program.cs:Zeile 17.
   bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()

ModList.Refresh();
}

private void RecommendedModsToggleCheckbox_CheckedChanged(object sender, EventArgs e)
{
var state = ((CheckBox)sender).Checked;
foreach (ListViewItem item in RecommendedModsListView.Items)
{
if (item.Checked != state)
{
item.Checked = state;
}
}
RecommendedModsListView.Refresh();
}

}

public class GUIUser : NullUser
Expand Down
2 changes: 2 additions & 0 deletions GUI/MainInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,14 @@ private void UpdateRecommendedDialog(Dictionary<string, List<string>> mods, bool
RecommendedDialogLabel.Text =
"The following modules have been recommended by one or more of the chosen modules:";
RecommendedModsListView.Columns[1].Text = "Recommended by:";
RecommendedModsToggleCheckbox.Text = "(De-)select all recommended mods.";
}
else
{
RecommendedDialogLabel.Text =
"The following modules have been suggested by one or more of the chosen modules:";
RecommendedModsListView.Columns[1].Text = "Suggested by:";
RecommendedModsToggleCheckbox.Text = "(De-)select all suggested mods.";
}


Expand Down