Skip to content

Commit

Permalink
Fix enabled status of continue button in choose provides screen.
Browse files Browse the repository at this point in the history
See #1002 (comment) for bug report.
  • Loading branch information
RichardLake committed Jun 3, 2015
1 parent 4b5d3e4 commit 2cbcdf1
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions GUI/MainInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public partial class Main
// this may happen on the recommended/suggested mods dialogs
private volatile bool installCanceled;

// this will be the final list of mods we want to install
// this will be the final list of mods we want to install
private HashSet<string> toInstall = new HashSet<string>();

private void InstallMods(object sender, DoWorkEventArgs e) // this probably needs to be refactored
Expand All @@ -30,7 +30,7 @@ private void InstallMods(object sender, DoWorkEventArgs e) // this probably need
(KeyValuePair<List<KeyValuePair<CkanModule, GUIModChangeType>>, RelationshipResolverOptions>) e.Argument;

ModuleInstaller installer = ModuleInstaller.GetInstance(CurrentInstance, GUI.user);
// setup progress callback
// setup progress callback

toInstall = new HashSet<string>();
var toUninstall = new HashSet<string>();
Expand Down Expand Up @@ -194,7 +194,7 @@ private void InstallMods(object sender, DoWorkEventArgs e) // this probably need
m_TabController.ShowTab("WaitTabPage");
m_TabController.SetTabLock(true);


var downloader = new NetAsyncDownloader(GUI.user);
cancelCallback = () =>
{
Expand Down Expand Up @@ -228,7 +228,7 @@ private void InstallMods(object sender, DoWorkEventArgs e) // this probably need
var ret = InstallList(toInstall, opts.Value, downloader);
if (!ret)
{
// install failed for some reason, error message is already displayed to the user
// install failed for some reason, error message is already displayed to the user
e.Result = new KeyValuePair<bool, List<KeyValuePair<CkanModule, GUIModChangeType>>>(false,
opts.Key);
return;
Expand Down Expand Up @@ -420,23 +420,22 @@ private void UpdateProvidedModsDialog(TooManyModsProvideKraken tooManyProvides,
ChooseProvidedModsContinueButton.Enabled = false;
}


private void ChooseProvidedModsListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
var any_item_selected = ChooseProvidedModsListView.Items.Cast<ListViewItem>().Any(item => item.Checked);
ChooseProvidedModsContinueButton.Enabled = any_item_selected;
if (!e.Item.Checked)
{
ChooseProvidedModsContinueButton.Enabled = false;
return;
}
ChooseProvidedModsContinueButton.Enabled = true;

foreach (ListViewItem item in ChooseProvidedModsListView.Items)
foreach (ListViewItem item in ChooseProvidedModsListView.Items.Cast<ListViewItem>()
.Where(item => item != e.Item && item.Checked))
{
if (item != e.Item && item.Checked)
{
item.Checked = false;
}
item.Checked = false;
}

}

private void ChooseProvidedModsCancelButton_Click(object sender, EventArgs e)
Expand All @@ -449,8 +448,8 @@ private void ChooseProvidedModsContinueButton_Click(object sender, EventArgs e)
foreach (ListViewItem item in ChooseProvidedModsListView.Items)
{
if (item.Checked)
{
toomany_source.SetResult((CkanModule)item.Tag);
{
toomany_source.SetResult((CkanModule)item.Tag);
}
}
}
Expand Down

0 comments on commit 2cbcdf1

Please sign in to comment.