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

IDialogService.Close manage a boolean return type such as IDialogServ… #116

Merged
merged 6 commits into from
Aug 16, 2020

Conversation

rogiardi
Copy link
Contributor

@rogiardi rogiardi commented Aug 6, 2020

…ice.Activate method.

Description

In case Show or ShowModal are based on certain logic, you cannot know if the window is modal or not. If you also need to close the window from its ViewModel, you can call .Close(this) without worrying about possible exceptions.
To check if window has been found and correctly closed, you can test the boolean result

Checklist

  • I have squashed my commits into a single one with a message that aligns with the contributing guidelines
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@FantasticFiasco
Copy link
Owner

I'm currently on a mini-vacation and will be back on Saturday. I'll look more closely at the PR then, but from a glance I think we should cover this use-case with tests.

@FantasticFiasco
Copy link
Owner

The current behavior is to throw an exception when closing a dialog fails, and with your changes the behavior will be that a boolean is returned indicating whether the operation was successful or not.

Both behaviors convey whether the operation was successful or not, am I correct in that statement? I'm here scratching my head thinking I'm missing something, but then again it's early morning here in Sweden and my brain is in startup mode.

With your changes, what do we gain other than that the caller can use if statements instead of try/catchstatements?

@rogiardi
Copy link
Contributor Author

rogiardi commented Aug 7, 2020 via email

@FantasticFiasco
Copy link
Owner

Your argument is sound, having a parity between IDialogService.Activate and IDialogService.Close is probably a good thing, but I have some considerations.

  • Regarding your 3), to truly being able to call Close without any try/catch statement we need to catch the exceptions in IDialogService.Close. As you say, if System.Windows.Window.Close throws an exception, it has to be caught in DialogService.Close. Do you agree?
  • Returning a boolean instead of throwing an exception is a breaking behavioral change. This has to be indicated with a new major version. Unfortunately I don't think the value of the PR is enough to grant a new major version. What we can do is this. I've created a new branch called releases/v8. If you edit the PR to target that branch instead of master, then I can keep breaking changes on that branch until there is value enough to create a new major version. I can also publish pre-releases from that branch, lets say we call it 8.0.0-beta1 or something similar, and you can take a dependency on that package until the new major version is released. Would that be acceptable to you?

@FantasticFiasco
Copy link
Owner

BTW, your English is perfect, you should not apologize for it.

@rogiardi
Copy link
Contributor Author

Hi Mattias,
I'm really glad to read your comments about my considerations.
Regarding your comment at point 3: yes absolutely, I agree with you.
As you said the content and the value of my PR is not enough for a new major version, your proposal of publishing a new beta version is the right solution. This is absolutely acceptable for me and the team I working on.
I'll switch my PR to releases/V8 branch asap. Please let me know when we can update the package refence from Nuget.
Congratulations for the good Job on MVVMDialog, It's a very useful component and, if you agree, I would be so happy to give my contribute on it. Let me know if you have some bug or other short activity that I could achieve for you.

Thanks for your availability and see you soon.

Regards,

Roberto.

@rogiardi rogiardi changed the base branch from master to releases/v8 August 10, 2020 07:50
@FantasticFiasco
Copy link
Owner

I'll prepare the code for the release, but I have to do one other thing first. I'm estimating that we'll have a release for you later this week.

@rogiardi
Copy link
Contributor Author

Perfect Mattias, take your time, there's no hurry..

@FantasticFiasco FantasticFiasco merged commit 3e9879c into FantasticFiasco:releases/v8 Aug 16, 2020
@FantasticFiasco
Copy link
Owner

@rogiardi v8.0.0-beta.1 has now been published on www.nuget.org. Would you be able to update and see if the changes are according to your requirements?

FantasticFiasco pushed a commit that referenced this pull request Aug 18, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Aug 19, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Aug 19, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
@rogiardi
Copy link
Contributor Author

Hi Mattias,
sorry for delay, I was out for a vacation... Yes, I saw you added an internal try-catch block in Close method. That changes are compliant with our requirements.. I'm going to reference the new version right now.. I'll update you soon..

Thanks,

Roberto.

FantasticFiasco pushed a commit that referenced this pull request Aug 25, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Aug 27, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Oct 3, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Nov 16, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco pushed a commit that referenced this pull request Nov 16, 2020
IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.
FantasticFiasco added a commit that referenced this pull request Nov 16, 2020
* feat: IDialogService.Close returns boolean indicating success (#116)

IDialogService.Close returns false instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of IDialogService.Activate.

* release v8.0.0-beta.1

* release v8.0.0-beta.2

* release v8.0.0-beta.3

* release v8.0.0-beta.4

* chore: update assembly version

Co-authored-by: Roberto Giardi <roberto.giardi@eng.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants