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

improve confirmation text #1639

Merged
merged 4 commits into from
Sep 26, 2023
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BrightIdeasSoftware;
using FAnsi.Discovery;
Expand Down Expand Up @@ -392,18 +393,22 @@ private void ddCategoriseMany_SelectedIndexChanged(object sender, EventArgs e)
{
var filteredObjects = olvColumnExtractability.FilteredObjects.Cast<ColPair>().ToArray();
var toChangeTo = ddCategoriseMany.SelectedItem;
var itemsToChange = filteredObjects.Where(obj => obj.ExtractionInformation is null || !obj.ExtractionInformation.ExtractionCategory.Equals(toChangeTo)).Select(static cp => cp.CatalogueItem.Name).ToArray();
var columnChangeDetails = itemsToChange.Length < 3
? new StringBuilder().AppendJoin(", ", itemsToChange[0..^1])
.Append((itemsToChange.Length > 1) ? " and " : "").Append(itemsToChange[^1]).ToString()
: $"{(itemsToChange.Length == filteredObjects.Length ? "all " : "")}{itemsToChange.Length} columns";

if (MessageBox.Show($"Set {columnChangeDetails} to '{toChangeTo}'?",
"Confirm Overwrite?", MessageBoxButtons.OKCancel) != DialogResult.OK) return;

foreach (var o in filteredObjects)
if (toChangeTo.Equals(NotExtractable))
MakeExtractable(o, false);
else
MakeExtractable(o, true, (ExtractionCategory)toChangeTo);

if (MessageBox.Show($"Set {filteredObjects.Length} to '{toChangeTo}'?",
"Confirm Overwrite?", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
foreach (object o in filteredObjects)
if (toChangeTo.Equals(NotExtractable))
MakeExtractable(o, false);
else
MakeExtractable(o, true, (ExtractionCategory)toChangeTo);

_ddChangeAllChanged = true;
}
_ddChangeAllChanged = true;
}

private void FinaliseExtractability()
Expand Down
Loading