Skip to content

Commit

Permalink
feat: release v8 draft (#129)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
FantasticFiasco and rogiardi authored Nov 16, 2020
1 parent 6229a6d commit 87b84fb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ This project adheres to [Semantic Versioning](http://semver.org/) and is followi

## Unreleased

NOTE: Features with breaking changes are found on branch [releases/v8](https://github.com/FantasticFiasco/mvvm-dialogs/tree/releases/v8) and will stay there until a new major version is released. Until then the features have been published to [www.nuget.org](https://www.nuget.org/packages/MvvmDialogs/) as pre-releases to v8.

### :zap: Added

- Support for .NET Core 3.1

### :syringe: Changed

- [#116](https://github.com/FantasticFiasco/mvvm-dialogs/issues/116) [BREAKING CHANGE] `IDialogService.Close` returns `false` instead of throwing an exception when failing to close a dialog. This behavior aligns with the behavior of `IDialogService.Activate`.

### :skull: Removed

- [BREAKING CHANGE] Support for .NET Core 3.0 due to [deprecation as of March 3, 2020](https://dotnet.microsoft.com/platform/support/policy/dotnet-core)
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<VersionPrefix>7.1.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionPrefix>8.0.0</VersionPrefix>
<VersionSuffix>beta.4</VersionSuffix>
<Authors>Mattias Kindborg</Authors>
<Company>FantasticFiasco</Company>
<Product>MVVM Dialogs</Product>
Expand Down
2 changes: 1 addition & 1 deletion SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
[assembly: AssemblyCulture("")]

// Assembly version
[assembly: AssemblyVersion("7.1.1")]
[assembly: AssemblyVersion("8.0.0")]
15 changes: 10 additions & 5 deletions src/net/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,30 @@ select window.Activate()
}

/// <inheritdoc />
public void Close(INotifyPropertyChanged viewModel)
public bool Close(INotifyPropertyChanged viewModel)
{
if (viewModel == null) throw new ArgumentNullException(nameof(viewModel));

foreach (Window? window in Application.Current.Windows)
{
if (window == null)
if (window == null || !viewModel.Equals(window.DataContext))
{
continue;
}

if (viewModel.Equals(window.DataContext))
try
{
window.Close();
return;
return true;
}
catch (Exception e)
{
Logger.Write($"Failed to close dialog: {e}");
break;
}
}

throw new DialogNotFoundException();
return false;
}

/// <inheritdoc />
Expand Down
8 changes: 4 additions & 4 deletions src/net/IDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ void Show(
/// <see cref="Show{T}"/> or <see cref="ShowCustom{T}"/>.
/// </summary>
/// <param name="viewModel">The view model of the dialog to close.</param>
/// <exception cref="DialogNotFoundException">
/// No dialog is found with specified view model as data context.
/// </exception>
void Close(INotifyPropertyChanged viewModel);
/// <returns>
/// true if the <see cref="Window"/> was successfully closed; otherwise, false.
/// </returns>
bool Close(INotifyPropertyChanged viewModel);

/// <summary>
/// Displays a message box that has a message, title bar caption, button, and icon; and
Expand Down

0 comments on commit 87b84fb

Please sign in to comment.