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

Do not prompt for close on import #1462

Merged
merged 4 commits into from
Jan 31, 2022

Conversation

abdelr
Copy link
Member

@abdelr abdelr commented Jan 28, 2022

Fixes #1460 (Do not prompt for close on import)

@abdelr abdelr added the Importer-Redesign Redesign of observed data import label Jan 28, 2022
@abdelr abdelr self-assigned this Jan 28, 2022
@msevestre
Copy link
Member

What does the view.CloseOnImport do? Why is the presenter asking the view to trigger the close? This feels weird.

Also needs test

Copy link
Member

@msevestre msevestre left a comment

Choose a reason for hiding this comment

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

Test missing and wondering about flow between view and presenter. Going to check the code

@@ -41,10 +41,13 @@ public ModalImporterPresenter(IModalImporterView view, IImporterPresenter import
AddSubPresenters(importerPresenter);
}

private bool _shouldPromtBeforeClose = false;
Copy link
Member

Choose a reason for hiding this comment

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

move the definition of this flag at the top (use resharper) and correct typo (Prompt)

_importerPresenter.OnTriggerImport += (s, d) =>
{
_shouldPromtBeforeClose = false;
_view.CloseOnImport();
Copy link
Member

Choose a reason for hiding this comment

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

Oh see. This methods already exists and it is called CloseView.
From the name it looked it was triggering some event.. (Onxxx) .Naming is really everything in programming :)

Copy link
Member

Choose a reason for hiding this comment

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

"There are only two hard things in Computer Science: cache invalidation and naming things"?
Phil Karlton

😅

@abdelr
Copy link
Member Author

abdelr commented Jan 28, 2022

@msevestre the test is not valid because the view.Display() method returns immediately. So, this is a blocking scenario. I have some ideas on how to implement this but I wonder if we already have some support for it. We could talk later about it if you want.

@msevestre
Copy link
Member

A few remarks:
First,why are you registering the event outside of the constructor?
Second, why are you registering to the event twice?
Last we never have this type of boolean hanging around to decide if we should close or not. Any idea why this is required here?

Copy link
Member

@msevestre msevestre left a comment

Choose a reason for hiding this comment

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

Is the test ok now? @abdelr

@abdelr abdelr requested a review from msevestre January 31, 2022 19:55
@abdelr
Copy link
Member Author

abdelr commented Jan 31, 2022

We still do not have a cancel button, but I am not sure if we want to change this. In any case, if we do, it will be just adding the button which will invoke form close but keep in mind that we already have some buttons changing captions and could be a bit confusing. We have the X button anyways.

Behavior seems to work properly now... close -> prompt, import -> close silently

@msevestre msevestre merged commit 62c1629 into develop Jan 31, 2022
@msevestre msevestre deleted the 1460_Do_not_prompt_for_close_on_import branch January 31, 2022 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Importer-Redesign Redesign of observed data import
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing a file: Are you sure you want to cancel
3 participants