-
Notifications
You must be signed in to change notification settings - Fork 100
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
* changed Run Peptide Search to keep wizard form close button visible #3337
* changed Run Peptide Search to keep wizard form close button visible #3337
Conversation
chambm
commented
Jan 16, 2025
•
edited
Loading
edited
- changed Run Peptide Search to keep wizard form close button visible, but intercept it while search is running and display an explanation message to click cancel search button
I thought about avoiding the |
…, but intercept it while search is running and display an explanation message to click cancel search button
f01df0b
to
f527cae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of feedback and at least one change requested.
@@ -1486,6 +1491,13 @@ public void CloseWizard(DialogResult result) | |||
|
|||
protected override void OnFormClosing(FormClosingEventArgs e) | |||
{ | |||
// Ask current WizardPageControl if wizard is in a good state to close | |||
if ((GetPageControl(wizardPagesImportPeptideSearch.SelectedTab) as WizardPageControl)?.CanWizardClose() == false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please encapsulate this logic in a function. Looks ugly to me in the if clause.
pwiz_tools/Skyline/FileUI/PeptideSearch/PeptideSearchResources.resx
Outdated
Show resolved
Hide resolved
pwiz_tools/Skyline/FileUI/PeptideSearch/ImportPeptideSearchDlg.cs
Outdated
Show resolved
Hide resolved
…e search and closing the form when the search cancellation finishes * added test for the "no" branch to TestDdaSearch
Updated screenshot and addressed the review points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment where I am not even positive "== false" is correct, except that you seem to be testing it. Easy to change to what I am suggesting. So, approving these changes.
private bool CanWizardClose() | ||
{ | ||
var wizardPageControl = GetPageControl(wizardPagesImportPeptideSearch.SelectedTab) as WizardPageControl; | ||
return wizardPageControl?.CanWizardClose() == false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this return statement confusing and prefer "?? true" to express the default case when wizardPageControl is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I forgot to invert the logic when I made it a function. As written, it's really functioning as a "CannotCloseWizard()" function. I'll invert here and where it's used because CanWizardClose() is more natural.