From def6ab606ff0428025cfea2503880cbfe2f015c8 Mon Sep 17 00:00:00 2001 From: Etienne Charland Date: Fri, 14 Jul 2023 18:54:15 -0500 Subject: [PATCH] Remove AppSettings, change design --- LICENSE | 191 ------------------ .../Demo.CrossPlatform.Android.csproj | 2 +- .../MainActivity.cs | 16 +- .../SplashActivity.cs | 31 --- .../Demo.CrossPlatform.Desktop.csproj | 1 - .../Demo.CrossPlatform.Desktop/Program.cs | 1 - .../Demo.CrossPlatform.Web.csproj | 4 +- .../Demo.CrossPlatform.csproj | 3 +- .../CrossPlatform/Directory.Build.props | 2 +- .../Demo.ActivateNonModalDialog.csproj | 10 +- .../Demo.CloseNonModalDialog.csproj | 10 +- .../CustomDialogFactory.cs | 12 +- .../Demo.CustomOpenFolderDialog.csproj | 10 +- .../Demo.DialogHost/Demo.DialogHost.csproj | 12 +- .../DialogServiceExtensions.cs | 4 +- .../Demo.FluentContentDialog.csproj | 10 +- .../Demo.FluentMessageBoxContentDialog.csproj | 8 +- .../Demo.FluentMessageBoxTaskDialog.csproj | 10 +- .../Demo.FluentTaskDialog.csproj | 10 +- .../Demo.MessageBox/Demo.MessageBox.csproj | 10 +- .../Demo.MessageBoxAuraUI.csproj | 2 +- .../Demo.ModalCustomDialog.csproj | 10 +- .../Demo.ModalDialog.Tests.csproj | 12 +- .../Demo.ModalDialog/Demo.ModalDialog.csproj | 10 +- .../Demo.NonModalCustomDialog.csproj | 10 +- .../Demo.NonModalDialog.csproj | 10 +- .../Demo.OpenFileDialog.csproj | 10 +- .../Demo.OpenFolderDialog.csproj | 10 +- .../Demo.SaveFileDialog.csproj | 10 +- .../Demo.StrongLocator.csproj | 12 +- .../Demo.ViewEvents/Demo.ViewEvents.csproj | 13 +- samples/Avalonia/Demo.ViewEvents/Program.cs | 3 +- .../Demo.ActivateNonModalDialog.csproj | 2 +- .../Demo.CloseNonModalDialog.csproj | 2 +- .../CustomDialogFactory.cs | 14 +- .../Demo.CustomOpenFolderDialog.csproj | 2 +- .../Demo.MessageBox/Demo.MessageBox.csproj | 2 +- .../Demo.ModalCustomDialog.csproj | 2 +- .../Demo.ModalDialog.Tests.csproj | 6 +- .../Demo.ModalDialog/Demo.ModalDialog.csproj | 2 +- .../Demo.NonModalCustomDialog.csproj | 2 +- .../Demo.NonModalDialog.csproj | 2 +- .../Demo.OpenFileDialog.csproj | 2 +- .../Demo.OpenFolderDialog.csproj | 2 +- .../Demo.SaveFileDialog.csproj | 2 +- .../Demo.StrongLocator.csproj | 2 +- .../Demo.ViewEvents/Demo.ViewEvents.csproj | 2 +- src/Directory.Build.props | 3 +- .../DialogHostDialogFactory.cs | 8 +- .../DialogServiceExtensions.cs | 5 +- .../MvvmDialogs.Avalonia.DialogHost.csproj | 4 +- .../DialogServiceExtensions.cs | 10 +- .../FluentDialogFactory.cs | 12 +- .../MvvmDialogs.Avalonia.Fluent.csproj | 4 +- .../DialogFactoryExtensions.cs | 8 +- .../IMessageBoxApi.cs | 2 +- .../MessageBoxApi.cs | 25 ++- .../MessageBoxDialogFactory.cs | 15 +- .../MessageBoxMode.cs | 16 ++ .../MvvmDialogs.Avalonia.MessageBox.csproj | 4 +- src/MvvmDialogs.Avalonia.MessageBox/Usings.cs | 2 + .../MvvmDialogs.Avalonia.Tests.csproj | 8 +- src/MvvmDialogs.Avalonia/AppDialogSettings.cs | 14 -- src/MvvmDialogs.Avalonia/DialogFactory.cs | 16 +- src/MvvmDialogs.Avalonia/DialogFactoryBase.cs | 5 +- src/MvvmDialogs.Avalonia/DialogService.cs | 5 +- .../MvvmDialogs.Avalonia.csproj | 2 +- src/MvvmDialogs.Wpf/AppDialogSettings.cs | 30 --- src/MvvmDialogs.Wpf/DialogFactory.cs | 59 ++++-- src/MvvmDialogs.Wpf/DialogFactoryBase.cs | 20 +- src/MvvmDialogs.Wpf/DialogManager.cs | 4 +- src/MvvmDialogs.Wpf/DialogService.cs | 5 +- .../DialogServiceExtensions.cs | 31 ++- src/MvvmDialogs.Wpf/IDialogFactorySync.cs | 3 +- src/MvvmDialogs.Wpf/IDialogManagerSync.cs | 3 +- src/MvvmDialogs.Wpf/MvvmDialogs.Wpf.csproj | 2 +- src/MvvmDialogs/AppDialogSettingsBase.cs | 13 -- src/MvvmDialogs/DialogManagerBase.cs | 18 +- src/MvvmDialogs/DialogServiceBase.cs | 9 +- src/MvvmDialogs/DialogServiceExtensions.cs | 36 ++-- src/MvvmDialogs/IDialogFactory.cs | 3 +- src/MvvmDialogs/IDialogManager.cs | 8 +- src/MvvmDialogs/IDialogService.cs | 5 - 83 files changed, 333 insertions(+), 599 deletions(-) delete mode 100644 LICENSE delete mode 100644 samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/SplashActivity.cs create mode 100644 src/MvvmDialogs.Avalonia.MessageBox/MessageBoxMode.cs delete mode 100644 src/MvvmDialogs.Avalonia/AppDialogSettings.cs delete mode 100644 src/MvvmDialogs.Wpf/AppDialogSettings.cs delete mode 100644 src/MvvmDialogs/AppDialogSettingsBase.cs diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b3578ee..0000000 --- a/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2009-2021 Mattias Kindborg - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/Demo.CrossPlatform.Android.csproj b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/Demo.CrossPlatform.Android.csproj index c9378a5..7e83660 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/Demo.CrossPlatform.Android.csproj +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/Demo.CrossPlatform.Android.csproj @@ -18,7 +18,7 @@ - + diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/MainActivity.cs b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/MainActivity.cs index d28e4ad..a9eb764 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/MainActivity.cs +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/MainActivity.cs @@ -1,10 +1,22 @@ using Android.App; using Android.Content.PM; +using Avalonia; using Avalonia.Android; +using Avalonia.ReactiveUI; namespace Demo.CrossPlatform.Android; -[Activity(Label = "Avalonia11.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] -public class MainActivity : AvaloniaMainActivity +[Activity( + Label = "Avalonia11.Android", + Theme = "@style/MyTheme.NoActionBar", + Icon = "@drawable/icon", + MainLauncher = true, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] +public class MainActivity : AvaloniaMainActivity { + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) + { + return base.CustomizeAppBuilder(builder) + .UseReactiveUI(); + } } diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/SplashActivity.cs b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/SplashActivity.cs deleted file mode 100644 index ec9714f..0000000 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Android/SplashActivity.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Android.App; -using Android.Content; -using Android.OS; -using Avalonia; -using Avalonia.Android; -using Avalonia.ReactiveUI; -using Application = Android.App.Application; - -namespace Demo.CrossPlatform.Android; - -[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] -public class SplashActivity : AvaloniaSplashActivity -{ - protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) - { - return base.CustomizeAppBuilder(builder) - .UseReactiveUI(); - } - - protected override void OnCreate(Bundle? savedInstanceState) - { - base.OnCreate(savedInstanceState); - } - - protected override void OnResume() - { - base.OnResume(); - - StartActivity(new Intent(Application.Context, typeof(MainActivity))); - } -} diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Demo.CrossPlatform.Desktop.csproj b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Demo.CrossPlatform.Desktop.csproj index 94a0ecc..3437101 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Demo.CrossPlatform.Desktop.csproj +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Demo.CrossPlatform.Desktop.csproj @@ -16,7 +16,6 @@ - diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Program.cs b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Program.cs index c8c92d9..a89c55e 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Program.cs +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Desktop/Program.cs @@ -1,7 +1,6 @@ using System; using Avalonia; using Avalonia.ReactiveUI; -using FluentAvalonia.UI.Windowing; namespace Demo.CrossPlatform.Desktop; diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Web/Demo.CrossPlatform.Web.csproj b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Web/Demo.CrossPlatform.Web.csproj index 18b1950..2695488 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Web/Demo.CrossPlatform.Web.csproj +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform.Web/Demo.CrossPlatform.Web.csproj @@ -16,7 +16,7 @@ - - + + diff --git a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform/Demo.CrossPlatform.csproj b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform/Demo.CrossPlatform.csproj index 1b2cc37..df772ce 100644 --- a/samples/Avalonia/CrossPlatform/Demo.CrossPlatform/Demo.CrossPlatform.csproj +++ b/samples/Avalonia/CrossPlatform/Demo.CrossPlatform/Demo.CrossPlatform.csproj @@ -17,13 +17,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/samples/Avalonia/CrossPlatform/Directory.Build.props b/samples/Avalonia/CrossPlatform/Directory.Build.props index 5a014d1..ae8bdf5 100644 --- a/samples/Avalonia/CrossPlatform/Directory.Build.props +++ b/samples/Avalonia/CrossPlatform/Directory.Build.props @@ -1,6 +1,6 @@ enable - 11.0.0-rc1.1 + 11.0.0 diff --git a/samples/Avalonia/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj b/samples/Avalonia/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj index f6889a1..a6678b9 100755 --- a/samples/Avalonia/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj +++ b/samples/Avalonia/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj @@ -9,12 +9,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj b/samples/Avalonia/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj index 11bd737..6e33a7f 100755 --- a/samples/Avalonia/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj +++ b/samples/Avalonia/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj @@ -8,12 +8,12 @@ Demo.Avalonia.CloseNonModalDialog - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs b/samples/Avalonia/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs index 2de1e81..c6759d4 100755 --- a/samples/Avalonia/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs +++ b/samples/Avalonia/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using Avalonia.Win32; using HanumanInstitute.MvvmDialogs; using HanumanInstitute.MvvmDialogs.FrameworkDialogs; using HanumanInstitute.MvvmDialogs.Avalonia; @@ -9,6 +8,7 @@ using System.Collections.Generic; using HanumanInstitute.MvvmDialogs.FileSystem; using HanumanInstitute.MvvmDialogs.PathInfo; +using Avalonia.Platform; namespace Demo.Avalonia.CustomOpenFolderDialog; @@ -27,19 +27,19 @@ public CustomDialogFactory(IPathInfoFactory infoFactory, IDialogFactory? chain = } /// - public override async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) => + public override async Task ShowDialogAsync(IView? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => await ShowOpenFolderDialogAsync(owner, s, appSettings), - _ => base.ShowDialogAsync(owner, settings, appSettings) + OpenFolderDialogSettings s => await ShowOpenFolderDialogAsync(owner, s), + _ => base.ShowDialogAsync(owner, settings) }; - private async Task> ShowOpenFolderDialogAsync(IView? owner, OpenFolderDialogSettings settings, AppDialogSettingsBase appSettings) + private async Task> ShowOpenFolderDialogAsync(IView? owner, OpenFolderDialogSettings settings) { if (owner == null) throw new ArgumentNullException(nameof(owner)); var window = TopLevel.GetTopLevel(owner.GetRef()); - var platformImpl = window?.PlatformImpl as WindowImpl; + var platformImpl = window?.PlatformImpl as IWindowImpl; if (platformImpl == null) { throw new NullReferenceException("Cannot obtain HWND handle for owner."); diff --git a/samples/Avalonia/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj b/samples/Avalonia/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj index fa00cdb..3338c4d 100755 --- a/samples/Avalonia/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj +++ b/samples/Avalonia/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj @@ -18,12 +18,12 @@ - - + + - - - + + + diff --git a/samples/Avalonia/Demo.DialogHost/Demo.DialogHost.csproj b/samples/Avalonia/Demo.DialogHost/Demo.DialogHost.csproj index 106d506..9cb5573 100755 --- a/samples/Avalonia/Demo.DialogHost/Demo.DialogHost.csproj +++ b/samples/Avalonia/Demo.DialogHost/Demo.DialogHost.csproj @@ -21,14 +21,14 @@ - - + + - - - + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/samples/Avalonia/Demo.DialogHost/DialogServiceExtensions.cs b/samples/Avalonia/Demo.DialogHost/DialogServiceExtensions.cs index 00d53aa..9ee723f 100644 --- a/samples/Avalonia/Demo.DialogHost/DialogServiceExtensions.cs +++ b/samples/Avalonia/Demo.DialogHost/DialogServiceExtensions.cs @@ -12,11 +12,11 @@ namespace HanumanInstitute.MvvmDialogs; /// public static class DialogServiceExtensions { - public static async Task AskTextAsync(this IDialogService service, INotifyPropertyChanged ownerViewModel, AppDialogSettingsBase? appSettings = null) + public static async Task AskTextAsync(this IDialogService service, INotifyPropertyChanged ownerViewModel) { var vm = service.CreateViewModel(); var settings = new DialogHostSettings(vm); - await service.ShowDialogHostAsync(ownerViewModel, settings, appSettings).ConfigureAwait(true); + await service.ShowDialogHostAsync(ownerViewModel, settings).ConfigureAwait(true); return vm.DialogResult == true ? vm.Text : null; } } diff --git a/samples/Avalonia/Demo.FluentContentDialog/Demo.FluentContentDialog.csproj b/samples/Avalonia/Demo.FluentContentDialog/Demo.FluentContentDialog.csproj index c8676ff..0a3a892 100755 --- a/samples/Avalonia/Demo.FluentContentDialog/Demo.FluentContentDialog.csproj +++ b/samples/Avalonia/Demo.FluentContentDialog/Demo.FluentContentDialog.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + diff --git a/samples/Avalonia/Demo.FluentMessageBoxContentDialog/Demo.FluentMessageBoxContentDialog.csproj b/samples/Avalonia/Demo.FluentMessageBoxContentDialog/Demo.FluentMessageBoxContentDialog.csproj index be4916b..7b28e6e 100755 --- a/samples/Avalonia/Demo.FluentMessageBoxContentDialog/Demo.FluentMessageBoxContentDialog.csproj +++ b/samples/Avalonia/Demo.FluentMessageBoxContentDialog/Demo.FluentMessageBoxContentDialog.csproj @@ -11,11 +11,11 @@ - - + + - - + + all diff --git a/samples/Avalonia/Demo.FluentMessageBoxTaskDialog/Demo.FluentMessageBoxTaskDialog.csproj b/samples/Avalonia/Demo.FluentMessageBoxTaskDialog/Demo.FluentMessageBoxTaskDialog.csproj index c3b01a8..c8001de 100755 --- a/samples/Avalonia/Demo.FluentMessageBoxTaskDialog/Demo.FluentMessageBoxTaskDialog.csproj +++ b/samples/Avalonia/Demo.FluentMessageBoxTaskDialog/Demo.FluentMessageBoxTaskDialog.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.FluentTaskDialog/Demo.FluentTaskDialog.csproj b/samples/Avalonia/Demo.FluentTaskDialog/Demo.FluentTaskDialog.csproj index 0e13161..9927e67 100755 --- a/samples/Avalonia/Demo.FluentTaskDialog/Demo.FluentTaskDialog.csproj +++ b/samples/Avalonia/Demo.FluentTaskDialog/Demo.FluentTaskDialog.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + diff --git a/samples/Avalonia/Demo.MessageBox/Demo.MessageBox.csproj b/samples/Avalonia/Demo.MessageBox/Demo.MessageBox.csproj index 785c4fc..ef10504 100755 --- a/samples/Avalonia/Demo.MessageBox/Demo.MessageBox.csproj +++ b/samples/Avalonia/Demo.MessageBox/Demo.MessageBox.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.MessageBoxAuraUI/Demo.MessageBoxAuraUI.csproj b/samples/Avalonia/Demo.MessageBoxAuraUI/Demo.MessageBoxAuraUI.csproj index 40e2b3e..16f3b52 100755 --- a/samples/Avalonia/Demo.MessageBoxAuraUI/Demo.MessageBoxAuraUI.csproj +++ b/samples/Avalonia/Demo.MessageBoxAuraUI/Demo.MessageBoxAuraUI.csproj @@ -19,7 +19,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/samples/Avalonia/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj b/samples/Avalonia/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj index 21d5fc4..572226c 100755 --- a/samples/Avalonia/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj +++ b/samples/Avalonia/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj b/samples/Avalonia/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj index 4dd0671..e3e38c4 100644 --- a/samples/Avalonia/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj +++ b/samples/Avalonia/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj @@ -12,13 +12,13 @@ - - - - + + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/samples/Avalonia/Demo.ModalDialog/Demo.ModalDialog.csproj b/samples/Avalonia/Demo.ModalDialog/Demo.ModalDialog.csproj index 7642503..71aea33 100755 --- a/samples/Avalonia/Demo.ModalDialog/Demo.ModalDialog.csproj +++ b/samples/Avalonia/Demo.ModalDialog/Demo.ModalDialog.csproj @@ -12,12 +12,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj b/samples/Avalonia/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj index f02b90e..e7b8727 100755 --- a/samples/Avalonia/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj +++ b/samples/Avalonia/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj @@ -8,12 +8,12 @@ Demo.Avalonia.NonModalCustomDialog - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.NonModalDialog/Demo.NonModalDialog.csproj b/samples/Avalonia/Demo.NonModalDialog/Demo.NonModalDialog.csproj index 1ef174c..59a9289 100755 --- a/samples/Avalonia/Demo.NonModalDialog/Demo.NonModalDialog.csproj +++ b/samples/Avalonia/Demo.NonModalDialog/Demo.NonModalDialog.csproj @@ -17,12 +17,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj b/samples/Avalonia/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj index 37e4178..dd72cd2 100755 --- a/samples/Avalonia/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj +++ b/samples/Avalonia/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj @@ -17,12 +17,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj b/samples/Avalonia/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj index 7705e8b..67d8aee 100755 --- a/samples/Avalonia/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj +++ b/samples/Avalonia/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj @@ -11,12 +11,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj b/samples/Avalonia/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj index 935b200..ba5ebe5 100755 --- a/samples/Avalonia/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj +++ b/samples/Avalonia/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj @@ -17,12 +17,12 @@ - - + + - - - + + + all diff --git a/samples/Avalonia/Demo.StrongLocator/Demo.StrongLocator.csproj b/samples/Avalonia/Demo.StrongLocator/Demo.StrongLocator.csproj index 03ef2f0..6936148 100755 --- a/samples/Avalonia/Demo.StrongLocator/Demo.StrongLocator.csproj +++ b/samples/Avalonia/Demo.StrongLocator/Demo.StrongLocator.csproj @@ -13,13 +13,13 @@ - - + + - - - - + + + + all diff --git a/samples/Avalonia/Demo.ViewEvents/Demo.ViewEvents.csproj b/samples/Avalonia/Demo.ViewEvents/Demo.ViewEvents.csproj index 0200b01..7321773 100755 --- a/samples/Avalonia/Demo.ViewEvents/Demo.ViewEvents.csproj +++ b/samples/Avalonia/Demo.ViewEvents/Demo.ViewEvents.csproj @@ -8,14 +8,13 @@ Demo.Avalonia.ViewEvents - - + + - - - - - + + + + all diff --git a/samples/Avalonia/Demo.ViewEvents/Program.cs b/samples/Avalonia/Demo.ViewEvents/Program.cs index 3b7e39b..b4567e2 100755 --- a/samples/Avalonia/Demo.ViewEvents/Program.cs +++ b/samples/Avalonia/Demo.ViewEvents/Program.cs @@ -19,6 +19,5 @@ public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() .LogToTrace() - .UseReactiveUI() - .UseFAWindowing(); + .UseReactiveUI(); } diff --git a/samples/Wpf/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj b/samples/Wpf/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj index 6e1f0c2..75fd7fd 100644 --- a/samples/Wpf/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj +++ b/samples/Wpf/Demo.ActivateNonModalDialog/Demo.ActivateNonModalDialog.csproj @@ -18,7 +18,7 @@ - + diff --git a/samples/Wpf/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj b/samples/Wpf/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj index 1b8c6ba..63a37f7 100644 --- a/samples/Wpf/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj +++ b/samples/Wpf/Demo.CloseNonModalDialog/Demo.CloseNonModalDialog.csproj @@ -18,7 +18,7 @@ - + diff --git a/samples/Wpf/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs b/samples/Wpf/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs index 7e5d996..251a727 100755 --- a/samples/Wpf/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs +++ b/samples/Wpf/Demo.CustomOpenFolderDialog/CustomDialogFactory.cs @@ -26,22 +26,22 @@ public CustomDialogFactory(IPathInfoFactory infoFactory, IDialogFactory? chain = } /// - public override async Task ShowDialogAsync(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => + public override async Task ShowDialogAsync(ViewWrapper? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFolderDialog(owner, s, appSettings)).ConfigureAwait(true), - _ => base.ShowDialogAsync(owner, settings, appSettings) + OpenFolderDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFolderDialog(owner, s)).ConfigureAwait(true), + _ => base.ShowDialogAsync(owner, settings) }; /// - public override object? ShowDialog(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => + public override object? ShowDialog(ViewWrapper? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => ShowOpenFolderDialog(owner, s, appSettings), - _ => base.ShowDialog(owner, settings, appSettings) + OpenFolderDialogSettings s => ShowOpenFolderDialog(owner, s), + _ => base.ShowDialog(owner, settings) }; - private IReadOnlyList ShowOpenFolderDialog(ViewWrapper? owner, OpenFolderDialogSettings settings, AppDialogSettings appSettings) + private IReadOnlyList ShowOpenFolderDialog(ViewWrapper? owner, OpenFolderDialogSettings settings) { if (owner == null) throw new ArgumentNullException(nameof(owner)); diff --git a/samples/Wpf/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj b/samples/Wpf/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj index df02ac7..dad744a 100644 --- a/samples/Wpf/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj +++ b/samples/Wpf/Demo.CustomOpenFolderDialog/Demo.CustomOpenFolderDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.MessageBox/Demo.MessageBox.csproj b/samples/Wpf/Demo.MessageBox/Demo.MessageBox.csproj index 6e83e2b..15a9ebf 100644 --- a/samples/Wpf/Demo.MessageBox/Demo.MessageBox.csproj +++ b/samples/Wpf/Demo.MessageBox/Demo.MessageBox.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj b/samples/Wpf/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj index 06f87f9..21088b1 100644 --- a/samples/Wpf/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj +++ b/samples/Wpf/Demo.ModalCustomDialog/Demo.ModalCustomDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj b/samples/Wpf/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj index abdc4aa..fed2b00 100755 --- a/samples/Wpf/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj +++ b/samples/Wpf/Demo.ModalDialog.Tests/Demo.ModalDialog.Tests.csproj @@ -11,10 +11,10 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/samples/Wpf/Demo.ModalDialog/Demo.ModalDialog.csproj b/samples/Wpf/Demo.ModalDialog/Demo.ModalDialog.csproj index 1149afc..b87eb99 100644 --- a/samples/Wpf/Demo.ModalDialog/Demo.ModalDialog.csproj +++ b/samples/Wpf/Demo.ModalDialog/Demo.ModalDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj b/samples/Wpf/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj index dafb242..b5f914c 100644 --- a/samples/Wpf/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj +++ b/samples/Wpf/Demo.NonModalCustomDialog/Demo.NonModalCustomDialog.csproj @@ -18,7 +18,7 @@ - + diff --git a/samples/Wpf/Demo.NonModalDialog/Demo.NonModalDialog.csproj b/samples/Wpf/Demo.NonModalDialog/Demo.NonModalDialog.csproj index 9d2cde3..bdfe082 100644 --- a/samples/Wpf/Demo.NonModalDialog/Demo.NonModalDialog.csproj +++ b/samples/Wpf/Demo.NonModalDialog/Demo.NonModalDialog.csproj @@ -18,7 +18,7 @@ - + diff --git a/samples/Wpf/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj b/samples/Wpf/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj index f9b731d..4a3174f 100644 --- a/samples/Wpf/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj +++ b/samples/Wpf/Demo.OpenFileDialog/Demo.OpenFileDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj b/samples/Wpf/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj index 5fa4136..f5879fb 100644 --- a/samples/Wpf/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj +++ b/samples/Wpf/Demo.OpenFolderDialog/Demo.OpenFolderDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj b/samples/Wpf/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj index 6a90f39..2995325 100644 --- a/samples/Wpf/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj +++ b/samples/Wpf/Demo.SaveFileDialog/Demo.SaveFileDialog.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.StrongLocator/Demo.StrongLocator.csproj b/samples/Wpf/Demo.StrongLocator/Demo.StrongLocator.csproj index 67de6d1..fd96177 100755 --- a/samples/Wpf/Demo.StrongLocator/Demo.StrongLocator.csproj +++ b/samples/Wpf/Demo.StrongLocator/Demo.StrongLocator.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/Wpf/Demo.ViewEvents/Demo.ViewEvents.csproj b/samples/Wpf/Demo.ViewEvents/Demo.ViewEvents.csproj index cc153a4..99c4872 100644 --- a/samples/Wpf/Demo.ViewEvents/Demo.ViewEvents.csproj +++ b/samples/Wpf/Demo.ViewEvents/Demo.ViewEvents.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 561328a..db8b21b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,14 +2,13 @@ 2.0.0 - rc1 Etienne Charland Hanuman Institute HanumanInstitute.MvvmDialogs Copyright © 2009-2023 MVVM Dialogs contributors en-US https://github.com/mysteryx93/HanumanInstitute.MvvmDialogs - Apache-2.0 + MIT Library simplifying the concept of opening dialogs from a view model when using MVVM in WPF wpf avalonia mvvm dialog window messagebox openfiledialog savefiledialog folderbrowserdialog messagedialog contentdialog fileopenpicker filesavepicker folderpicker android ios mobile xamarin diff --git a/src/MvvmDialogs.Avalonia.DialogHost/DialogHostDialogFactory.cs b/src/MvvmDialogs.Avalonia.DialogHost/DialogHostDialogFactory.cs index 2de0001..a797323 100644 --- a/src/MvvmDialogs.Avalonia.DialogHost/DialogHostDialogFactory.cs +++ b/src/MvvmDialogs.Avalonia.DialogHost/DialogHostDialogFactory.cs @@ -15,15 +15,15 @@ public DialogHostDialogFactory(IDialogFactory? chain = null) } /// - public override async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) => + public override async Task ShowDialogAsync(IView? owner, TSettings settings) => settings switch { // MessageBoxSettings s => await ShowMessageBoxDialogAsync(owner, s, appSettings).ConfigureAwait(true), - DialogHostSettings s => await ShowDialogHostAsync(owner, s, appSettings), - _ => await base.ShowDialogAsync(owner, settings, appSettings).ConfigureAwait(true) + DialogHostSettings s => await ShowDialogHostAsync(owner, s), + _ => await base.ShowDialogAsync(owner, settings).ConfigureAwait(true) }; - private async Task ShowDialogHostAsync(IView? owner, DialogHostSettings settings, AppDialogSettingsBase appSettings) + private async Task ShowDialogHostAsync(IView? owner, DialogHostSettings settings) { if (owner == null) { throw new ArgumentNullException(nameof(owner)); } var view = new DialogHostView(settings); diff --git a/src/MvvmDialogs.Avalonia.DialogHost/DialogServiceExtensions.cs b/src/MvvmDialogs.Avalonia.DialogHost/DialogServiceExtensions.cs index 3f150d5..1598782 100644 --- a/src/MvvmDialogs.Avalonia.DialogHost/DialogServiceExtensions.cs +++ b/src/MvvmDialogs.Avalonia.DialogHost/DialogServiceExtensions.cs @@ -16,17 +16,16 @@ public static class DialogServiceExtensions /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the content dialog. - /// Overrides application-wide settings configured on . /// The dialog button that was pressed. /// No view is registered with specified owner view model as data context. public static async Task ShowDialogHostAsync(this IDialogService service, INotifyPropertyChanged ownerViewModel, - DialogHostSettings? settings = null, AppDialogSettingsBase? appSettings = null) + DialogHostSettings? settings = null) { if (ownerViewModel == null) throw new ArgumentNullException(nameof(ownerViewModel)); if (settings == null) throw new ArgumentNullException(nameof(settings)); if (settings.Content == null) throw new ArgumentNullException(nameof(settings.Content)); return await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings, appSettings ?? service.AppSettings).ConfigureAwait(true); + ownerViewModel, settings).ConfigureAwait(true); } } diff --git a/src/MvvmDialogs.Avalonia.DialogHost/MvvmDialogs.Avalonia.DialogHost.csproj b/src/MvvmDialogs.Avalonia.DialogHost/MvvmDialogs.Avalonia.DialogHost.csproj index 0c157ce..9a2ea13 100644 --- a/src/MvvmDialogs.Avalonia.DialogHost/MvvmDialogs.Avalonia.DialogHost.csproj +++ b/src/MvvmDialogs.Avalonia.DialogHost/MvvmDialogs.Avalonia.DialogHost.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/src/MvvmDialogs.Avalonia.Fluent/DialogServiceExtensions.cs b/src/MvvmDialogs.Avalonia.Fluent/DialogServiceExtensions.cs index bb2debd..94ef253 100644 --- a/src/MvvmDialogs.Avalonia.Fluent/DialogServiceExtensions.cs +++ b/src/MvvmDialogs.Avalonia.Fluent/DialogServiceExtensions.cs @@ -15,16 +15,15 @@ public static class DialogServiceExtensions /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the content dialog. - /// Overrides application-wide settings configured on . /// The dialog button that was pressed. /// No view is registered with specified owner view model as data context. public static async Task ShowContentDialogAsync(this IDialogService service, INotifyPropertyChanged ownerViewModel, - ContentDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + ContentDialogSettings? settings = null) { if (ownerViewModel == null) throw new ArgumentNullException(nameof(ownerViewModel)); return (ContentDialogResult)(await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings ?? new ContentDialogSettings(), appSettings ?? service.AppSettings).ConfigureAwait(true) ?? ContentDialogResult.None); + ownerViewModel, settings ?? new ContentDialogSettings()).ConfigureAwait(true) ?? ContentDialogResult.None); } /// @@ -33,15 +32,14 @@ public static async Task ShowContentDialogAsync(this IDialo /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the task dialog. - /// Overrides application-wide settings configured on . /// The dialog return value. /// No view is registered with specified owner view model as data context. public static async Task ShowTaskDialogAsync(this IDialogService service, INotifyPropertyChanged ownerViewModel, - TaskDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + TaskDialogSettings? settings = null) { if (ownerViewModel == null) throw new ArgumentNullException(nameof(ownerViewModel)); return (TaskDialogStandardResult)(await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings ?? new TaskDialogSettings(), appSettings ?? service.AppSettings).ConfigureAwait(true) ?? TaskDialogStandardResult.None); + ownerViewModel, settings ?? new TaskDialogSettings()).ConfigureAwait(true) ?? TaskDialogStandardResult.None); } } diff --git a/src/MvvmDialogs.Avalonia.Fluent/FluentDialogFactory.cs b/src/MvvmDialogs.Avalonia.Fluent/FluentDialogFactory.cs index bac872a..4327830 100644 --- a/src/MvvmDialogs.Avalonia.Fluent/FluentDialogFactory.cs +++ b/src/MvvmDialogs.Avalonia.Fluent/FluentDialogFactory.cs @@ -23,15 +23,15 @@ public FluentDialogFactory(FluentMessageBoxType messageBoxType = FluentMessageBo } /// - public override async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) => + public override async Task ShowDialogAsync(IView? owner, TSettings settings) => settings switch { ContentDialogSettings s => await ShowContentDialogAsync(owner, s).ConfigureAwait(true), TaskDialogSettings s => await ShowTaskDialogAsync(owner, s).ConfigureAwait(true), - MessageBoxSettings s when _messageBoxType == FluentMessageBoxType.ContentDialog => await ShowMessageBoxContentDialogAsync(owner, s, appSettings) + MessageBoxSettings s when _messageBoxType == FluentMessageBoxType.ContentDialog => await ShowMessageBoxContentDialogAsync(owner, s) .ConfigureAwait(true), - MessageBoxSettings s when _messageBoxType == FluentMessageBoxType.TaskDialog => await ShowMessageBoxTaskDialogAsync(owner, s, appSettings).ConfigureAwait(true), - _ => await base.ShowDialogAsync(owner, settings, appSettings).ConfigureAwait(true) + MessageBoxSettings s when _messageBoxType == FluentMessageBoxType.TaskDialog => await ShowMessageBoxTaskDialogAsync(owner, s).ConfigureAwait(true), + _ => await base.ShowDialogAsync(owner, settings).ConfigureAwait(true) }; private async Task ShowContentDialogAsync(IView? owner, ContentDialogSettings settings) @@ -60,7 +60,7 @@ private async Task ShowTaskDialogAsync(IView? owner, TaskDialogSettings return view.DialogResult; } - private async Task ShowMessageBoxContentDialogAsync(IView? owner, MessageBoxSettings settings, AppDialogSettingsBase appSettings) + private async Task ShowMessageBoxContentDialogAsync(IView? owner, MessageBoxSettings settings) { var apiSettings = new ContentDialogSettings() { @@ -97,7 +97,7 @@ private async Task ShowTaskDialogAsync(IView? owner, TaskDialogSettings return result == yes ? true : result == no ? false : null; } - private async Task ShowMessageBoxTaskDialogAsync(IView? owner, MessageBoxSettings settings, AppDialogSettingsBase appSettings) + private async Task ShowMessageBoxTaskDialogAsync(IView? owner, MessageBoxSettings settings) { var apiSettings = new TaskDialogSettings() { diff --git a/src/MvvmDialogs.Avalonia.Fluent/MvvmDialogs.Avalonia.Fluent.csproj b/src/MvvmDialogs.Avalonia.Fluent/MvvmDialogs.Avalonia.Fluent.csproj index 33fd01d..59b3233 100644 --- a/src/MvvmDialogs.Avalonia.Fluent/MvvmDialogs.Avalonia.Fluent.csproj +++ b/src/MvvmDialogs.Avalonia.Fluent/MvvmDialogs.Avalonia.Fluent.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/src/MvvmDialogs.Avalonia.MessageBox/DialogFactoryExtensions.cs b/src/MvvmDialogs.Avalonia.MessageBox/DialogFactoryExtensions.cs index 79fe6de..11cfdeb 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/DialogFactoryExtensions.cs +++ b/src/MvvmDialogs.Avalonia.MessageBox/DialogFactoryExtensions.cs @@ -12,7 +12,11 @@ public static class DialogFactoryExtensions /// Registers MessageBox handlers in the dialog factory chain. /// /// The dialog factory to add handlers for. + /// The message box type to show. /// A new dialog factory that will fallback to the previous one. - public static IDialogFactory AddMessageBox(this IDialogFactory factory) => - new MessageBoxDialogFactory(factory); + public static IDialogFactory AddMessageBox(this IDialogFactory factory, MessageBoxMode mode = MessageBoxMode.Window) => + new MessageBoxDialogFactory(factory) + { + Mode = mode + }; } diff --git a/src/MvvmDialogs.Avalonia.MessageBox/IMessageBoxApi.cs b/src/MvvmDialogs.Avalonia.MessageBox/IMessageBoxApi.cs index e70dd2f..cfaddf0 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/IMessageBoxApi.cs +++ b/src/MvvmDialogs.Avalonia.MessageBox/IMessageBoxApi.cs @@ -3,5 +3,5 @@ namespace HanumanInstitute.MvvmDialogs.Avalonia.MessageBox; internal interface IMessageBoxApi { - Task ShowMessageBoxAsync(Window? owner, MessageBoxApiSettings settings); + Task ShowMessageBoxAsync(Window? owner, MessageBoxApiSettings settings, MessageBoxMode mode); } diff --git a/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxApi.cs b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxApi.cs index 4cb7c1b..c8caed7 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxApi.cs +++ b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxApi.cs @@ -4,14 +4,19 @@ namespace HanumanInstitute.MvvmDialogs.Avalonia.MessageBox; internal class MessageBoxApi : IMessageBoxApi { - public Task ShowMessageBoxAsync(Window? owner, MessageBoxApiSettings settings) => - MessageBoxManager.GetMessageBoxStandardWindow(new MessageBoxStandardParams() { - ContentTitle = settings.Title, - ContentMessage = settings.Text, - ButtonDefinitions = settings.Buttons, - Icon = settings.Icon, - WindowStartupLocation = settings.StartupLocation, - EnterDefaultButton = settings.EnterDefaultButton, - EscDefaultButton = settings.EscDefaultButton - }).ShowDialog(owner); + public Task ShowMessageBoxAsync(Window? owner, MessageBoxApiSettings settings, MessageBoxMode mode) + { + var msgBox = MessageBoxManager.GetMessageBoxStandard( + new MessageBoxStandardParams() + { + ContentTitle = settings.Title, + ContentMessage = settings.Text, + ButtonDefinitions = settings.Buttons, + Icon = settings.Icon, + WindowStartupLocation = settings.StartupLocation, + EnterDefaultButton = settings.EnterDefaultButton, + EscDefaultButton = settings.EscDefaultButton + }); + return mode == MessageBoxMode.Popup ? msgBox.ShowAsPopupAsync(owner) : msgBox.ShowWindowDialogAsync(owner); + } } diff --git a/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxDialogFactory.cs b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxDialogFactory.cs index 6819663..f50405a 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxDialogFactory.cs +++ b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxDialogFactory.cs @@ -11,6 +11,11 @@ public class MessageBoxDialogFactory : DialogFactoryBase { private readonly IMessageBoxApi _api; + /// + /// Gets or sets the message box type to show. + /// + public MessageBoxMode Mode { get; set; } + /// /// Initializes a new instance of a FrameworkDialog. /// @@ -32,14 +37,14 @@ internal MessageBoxDialogFactory(IDialogFactory? chain, IMessageBoxApi? api) } /// - public override async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) => + public override async Task ShowDialogAsync(IView? owner, TSettings settings) => settings switch { - MessageBoxSettings s => await ShowMessageBoxDialogAsync(owner, s, appSettings).ConfigureAwait(true), - _ => await base.ShowDialogAsync(owner, settings, appSettings).ConfigureAwait(true) + MessageBoxSettings s => await ShowMessageBoxDialogAsync(owner, s).ConfigureAwait(true), + _ => await base.ShowDialogAsync(owner, settings).ConfigureAwait(true) }; - private async Task ShowMessageBoxDialogAsync(IView? owner, MessageBoxSettings settings, AppDialogSettingsBase appSettings) + private async Task ShowMessageBoxDialogAsync(IView? owner, MessageBoxSettings settings) { var apiSettings = new MessageBoxApiSettings() { @@ -54,7 +59,7 @@ internal MessageBoxDialogFactory(IDialogFactory? chain, IMessageBoxApi? api) var ownerRef = owner.GetRef(); if (ownerRef is Window ownerWin) { - var result = await _api.ShowMessageBoxAsync(ownerWin, apiSettings); + var result = await _api.ShowMessageBoxAsync(ownerWin, apiSettings, Mode); return result switch { ButtonResult.Yes => true, diff --git a/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxMode.cs b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxMode.cs new file mode 100644 index 0000000..c63e498 --- /dev/null +++ b/src/MvvmDialogs.Avalonia.MessageBox/MessageBoxMode.cs @@ -0,0 +1,16 @@ +namespace HanumanInstitute.MvvmDialogs.Avalonia.MessageBox; + +/// +/// Represents the type of message box to display. +/// +public enum MessageBoxMode +{ + /// + /// Show message boxes as modal windows. + /// + Window, + /// + /// Show message boxes as popups. + /// + Popup +} diff --git a/src/MvvmDialogs.Avalonia.MessageBox/MvvmDialogs.Avalonia.MessageBox.csproj b/src/MvvmDialogs.Avalonia.MessageBox/MvvmDialogs.Avalonia.MessageBox.csproj index 23a57b9..3cbed84 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/MvvmDialogs.Avalonia.MessageBox.csproj +++ b/src/MvvmDialogs.Avalonia.MessageBox/MvvmDialogs.Avalonia.MessageBox.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/src/MvvmDialogs.Avalonia.MessageBox/Usings.cs b/src/MvvmDialogs.Avalonia.MessageBox/Usings.cs index 573ebd5..04026ad 100644 --- a/src/MvvmDialogs.Avalonia.MessageBox/Usings.cs +++ b/src/MvvmDialogs.Avalonia.MessageBox/Usings.cs @@ -2,5 +2,7 @@ global using System.Threading.Tasks; global using Avalonia; global using Avalonia.Controls; +global using MsBox.Avalonia; +global using MsBox.Avalonia.Enums; global using MessageBox.Avalonia; global using MessageBox.Avalonia.Enums; diff --git a/src/MvvmDialogs.Avalonia.Tests/MvvmDialogs.Avalonia.Tests.csproj b/src/MvvmDialogs.Avalonia.Tests/MvvmDialogs.Avalonia.Tests.csproj index 2710a47..1350624 100644 --- a/src/MvvmDialogs.Avalonia.Tests/MvvmDialogs.Avalonia.Tests.csproj +++ b/src/MvvmDialogs.Avalonia.Tests/MvvmDialogs.Avalonia.Tests.csproj @@ -10,12 +10,12 @@ - + - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/MvvmDialogs.Avalonia/AppDialogSettings.cs b/src/MvvmDialogs.Avalonia/AppDialogSettings.cs deleted file mode 100644 index 98518e2..0000000 --- a/src/MvvmDialogs.Avalonia/AppDialogSettings.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace HanumanInstitute.MvvmDialogs.Avalonia; - -/// -/// Provides Avalonia-specific application-wide settings. -/// Settings can be overriden for individual calls by specifying the optional appSettings parameter. -/// -public class AppDialogSettings : AppDialogSettingsBase -{ - /// - /// Creates a copy of this class. Useful to customize settings for specific calls. - /// - /// A copy of this class. - public AppDialogSettings Clone() => (AppDialogSettings)this.MemberwiseClone(); -} diff --git a/src/MvvmDialogs.Avalonia/DialogFactory.cs b/src/MvvmDialogs.Avalonia/DialogFactory.cs index df5836b..f345ecf 100644 --- a/src/MvvmDialogs.Avalonia/DialogFactory.cs +++ b/src/MvvmDialogs.Avalonia/DialogFactory.cs @@ -39,16 +39,16 @@ internal DialogFactory(IDialogFactory? chain, IFrameworkDialogsApi? api, IPathIn } /// - public override async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) => + public override async Task ShowDialogAsync(IView? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => await ShowOpenFolderDialogAsync(owner, s, appSettings).ConfigureAwait(true), - OpenFileDialogSettings s => await ShowOpenFileDialogAsync(owner, s, appSettings).ConfigureAwait(true), - SaveFileDialogSettings s => await ShowSaveFileDialogAsync(owner, s, appSettings).ConfigureAwait(true), - _ => await base.ShowDialogAsync(owner, settings, appSettings).ConfigureAwait(true) + OpenFolderDialogSettings s => await ShowOpenFolderDialogAsync(owner, s).ConfigureAwait(true), + OpenFileDialogSettings s => await ShowOpenFileDialogAsync(owner, s).ConfigureAwait(true), + SaveFileDialogSettings s => await ShowSaveFileDialogAsync(owner, s).ConfigureAwait(true), + _ => await base.ShowDialogAsync(owner, settings).ConfigureAwait(true) }; - private async Task> ShowOpenFolderDialogAsync(IView? owner, OpenFolderDialogSettings settings, AppDialogSettingsBase appSettings) + private async Task> ShowOpenFolderDialogAsync(IView? owner, OpenFolderDialogSettings settings) { var apiSettings = new FolderPickerOpenOptions() { @@ -59,7 +59,7 @@ private async Task> ShowOpenFolderDialogAsyn return await _api.ShowOpenFolderDialogAsync(owner.GetRef(), apiSettings).ConfigureAwait(true); } - private async Task> ShowOpenFileDialogAsync(IView? owner, OpenFileDialogSettings settings, AppDialogSettingsBase appSettings) + private async Task> ShowOpenFileDialogAsync(IView? owner, OpenFileDialogSettings settings) { var apiSettings = new FilePickerOpenOptions() { @@ -73,7 +73,7 @@ private async Task> ShowOpenFileDialogAsync(IV return await _api.ShowOpenFileDialogAsync(owner.GetRef(), apiSettings).ConfigureAwait(true) ?? Array.Empty(); } - private async Task ShowSaveFileDialogAsync(IView? owner, SaveFileDialogSettings settings, AppDialogSettingsBase appSettings) + private async Task ShowSaveFileDialogAsync(IView? owner, SaveFileDialogSettings settings) { var apiSettings = new FilePickerSaveOptions() { diff --git a/src/MvvmDialogs.Avalonia/DialogFactoryBase.cs b/src/MvvmDialogs.Avalonia/DialogFactoryBase.cs index c10f53b..ed46824 100644 --- a/src/MvvmDialogs.Avalonia/DialogFactoryBase.cs +++ b/src/MvvmDialogs.Avalonia/DialogFactoryBase.cs @@ -36,10 +36,9 @@ protected DialogFactoryBase(IDialogFactory? chain) } /// - public virtual async Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) + public virtual async Task ShowDialogAsync(IView? owner, TSettings settings) { - if (appSettings is not AppDialogSettings app) throw new ArgumentException($"{nameof(appSettings)} must be of type {nameof(AppDialogSettings)}"); - return Chain != null ? await Chain.ShowDialogAsync(owner, settings, app).ConfigureAwait(true) : + return Chain != null ? await Chain.ShowDialogAsync(owner, settings).ConfigureAwait(true) : throw new NotSupportedException($"There is no registered dialog in IDialogFactory for settings of type {typeof(TSettings).Name}."); } diff --git a/src/MvvmDialogs.Avalonia/DialogService.cs b/src/MvvmDialogs.Avalonia/DialogService.cs index 6deb2c3..5e5ffd4 100644 --- a/src/MvvmDialogs.Avalonia/DialogService.cs +++ b/src/MvvmDialogs.Avalonia/DialogService.cs @@ -22,14 +22,11 @@ public DialogService() /// Initializes a new instance of the class. /// /// Class responsible for UI interactions. - /// Set application-wide settings. /// Function used to create view model instances. This function is used only by and is not used internally. public DialogService( IDialogManager? dialogManager = null, - AppDialogSettings? settings = null, Func? viewModelFactory = null) - : base(settings ?? new AppDialogSettings(), - dialogManager ?? new DialogManager(dialogFactory: new DialogFactory()), + : base(dialogManager ?? new DialogManager(dialogFactory: new DialogFactory()), viewModelFactory) { } diff --git a/src/MvvmDialogs.Avalonia/MvvmDialogs.Avalonia.csproj b/src/MvvmDialogs.Avalonia/MvvmDialogs.Avalonia.csproj index 90fab18..d2fad17 100644 --- a/src/MvvmDialogs.Avalonia/MvvmDialogs.Avalonia.csproj +++ b/src/MvvmDialogs.Avalonia/MvvmDialogs.Avalonia.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/MvvmDialogs.Wpf/AppDialogSettings.cs b/src/MvvmDialogs.Wpf/AppDialogSettings.cs deleted file mode 100644 index e7952f7..0000000 --- a/src/MvvmDialogs.Wpf/AppDialogSettings.cs +++ /dev/null @@ -1,30 +0,0 @@ - -namespace HanumanInstitute.MvvmDialogs.Wpf; - -/// -/// Provides WPF-specific application-wide settings. -/// Settings can be overriden for individual calls by specifying the optional appSettings parameter. -/// -public class AppDialogSettings : AppDialogSettingsBase -{ - /// - /// Gets or sets whether message boxes are displayed right-to-left (RightAlign+RtlReading). - /// - public bool MessageBoxRightToLeft { get; set; } - - /// - /// Gets or sets whether to display on the default desktop of the interactive window station. Specifies that the message box is displayed from a .NET Windows Service application in order to notify the user of an event. - /// - public bool MessageBoxDefaultDesktopOnly { get; set; } - - /// - /// Gets or sets whether to display on the currently active desktop even if a user is not logged on to the computer. Specifies that the message box is displayed from a .NET Windows Service application in order to notify the user of an event. - /// - public bool MessageBoxServiceNotification { get; set; } - - /// - /// Creates a copy of this class. Useful to customize settings for specific calls. - /// - /// A copy of this class. - public AppDialogSettings Clone() => (AppDialogSettings)this.MemberwiseClone(); -} diff --git a/src/MvvmDialogs.Wpf/DialogFactory.cs b/src/MvvmDialogs.Wpf/DialogFactory.cs index 7585363..4f15171 100755 --- a/src/MvvmDialogs.Wpf/DialogFactory.cs +++ b/src/MvvmDialogs.Wpf/DialogFactory.cs @@ -44,29 +44,44 @@ internal DialogFactory(IDialogFactory? chain, IFrameworkDialogsApi? api, IPathIn _api = api ?? new FrameworkDialogsApi(_pathInfo); } + /// + /// Gets or sets whether message boxes are displayed right-to-left (RightAlign+RtlReading). + /// + public bool MessageBoxRightToLeft { get; set; } + + /// + /// Gets or sets whether to display on the default desktop of the interactive window station. Specifies that the message box is displayed from a .NET Windows Service application in order to notify the user of an event. + /// + public bool MessageBoxDefaultDesktopOnly { get; set; } + + /// + /// Gets or sets whether to display on the currently active desktop even if a user is not logged on to the computer. Specifies that the message box is displayed from a .NET Windows Service application in order to notify the user of an event. + /// + public bool MessageBoxServiceNotification { get; set; } + /// - public override async Task ShowDialogAsync(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => + public override async Task ShowDialogAsync(ViewWrapper? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFolderDialog(owner, s, appSettings)).ConfigureAwait(true), - OpenFileDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFileDialog(owner, s, appSettings)).ConfigureAwait(true), - SaveFileDialogSettings s => await UiExtensions.RunUiAsync(() => ShowSaveFileDialog(owner, s, appSettings)).ConfigureAwait(true), - MessageBoxSettings s => await UiExtensions.RunUiAsync(() => ShowMessageBox(owner, s, appSettings)).ConfigureAwait(true), - _ => base.ShowDialogAsync(owner, settings, appSettings) + OpenFolderDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFolderDialog(owner, s)).ConfigureAwait(true), + OpenFileDialogSettings s => await UiExtensions.RunUiAsync(() => ShowOpenFileDialog(owner, s)).ConfigureAwait(true), + SaveFileDialogSettings s => await UiExtensions.RunUiAsync(() => ShowSaveFileDialog(owner, s)).ConfigureAwait(true), + MessageBoxSettings s => await UiExtensions.RunUiAsync(() => ShowMessageBox(owner, s)).ConfigureAwait(true), + _ => base.ShowDialogAsync(owner, settings) }; /// - public override object? ShowDialog(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => + public override object? ShowDialog(ViewWrapper? owner, TSettings settings) => settings switch { - OpenFolderDialogSettings s => ShowOpenFolderDialog(owner, s, appSettings), - OpenFileDialogSettings s => ShowOpenFileDialog(owner, s, appSettings), - SaveFileDialogSettings s => ShowSaveFileDialog(owner, s, appSettings), - MessageBoxSettings s => ShowMessageBox(owner, s, appSettings), - _ => base.ShowDialog(owner, settings, appSettings) + OpenFolderDialogSettings s => ShowOpenFolderDialog(owner, s), + OpenFileDialogSettings s => ShowOpenFileDialog(owner, s), + SaveFileDialogSettings s => ShowSaveFileDialog(owner, s), + MessageBoxSettings s => ShowMessageBox(owner, s), + _ => base.ShowDialog(owner, settings) }; - private IReadOnlyList ShowOpenFolderDialog(ViewWrapper? owner, OpenFolderDialogSettings settings, AppDialogSettings appSettings) + private IReadOnlyList ShowOpenFolderDialog(ViewWrapper? owner, OpenFolderDialogSettings settings) { var apiSettings = new OpenFolderApiSettings() { @@ -78,7 +93,7 @@ private IReadOnlyList ShowOpenFolderDialog(ViewWrapper? ow return _api.ShowOpenFolderDialog(owner?.Ref, apiSettings); } - private IReadOnlyList ShowOpenFileDialog(ViewWrapper? owner, OpenFileDialogSettings settings, AppDialogSettings appSettings) + private IReadOnlyList ShowOpenFileDialog(ViewWrapper? owner, OpenFileDialogSettings settings) { var apiSettings = new OpenFileApiSettings() { @@ -92,7 +107,7 @@ private IReadOnlyList ShowOpenFileDialog(ViewWrapper? owner, return _api.ShowOpenFileDialog(owner?.Ref, apiSettings) ?? Array.Empty(); } - private IDialogStorageFile? ShowSaveFileDialog(ViewWrapper? owner, SaveFileDialogSettings settings, AppDialogSettings appSettings) + private IDialogStorageFile? ShowSaveFileDialog(ViewWrapper? owner, SaveFileDialogSettings settings) { var apiSettings = new SaveFileApiSettings() { @@ -144,7 +159,7 @@ private static string SyncFilters(List filters) return result.ToString(); } - private bool? ShowMessageBox(ViewWrapper? owner, MessageBoxSettings settings, AppDialogSettings appSettings) + private bool? ShowMessageBox(ViewWrapper? owner, MessageBoxSettings settings) { var apiSettings = new MessageBoxApiSettings() { @@ -153,7 +168,7 @@ private static string SyncFilters(List filters) Buttons = SyncButton(settings.Button), Icon = SyncIcon(settings.Icon), DefaultButton = SyncDefault(settings.Button, settings.DefaultValue), - Options = SyncOptions(appSettings) + Options = SyncOptions() }; var button = _api.ShowMessageBox(owner?.Ref, apiSettings); @@ -205,11 +220,11 @@ private static Win32Result SyncDefault(MessageBoxButton buttons, bool? value) => _ => Win32Result.None }; - private Win32Options SyncOptions(AppDialogSettings appSettings) => - EvalOption(appSettings.MessageBoxDefaultDesktopOnly, Win32Options.DefaultDesktopOnly) | - EvalOption(appSettings.MessageBoxRightToLeft, Win32Options.RightAlign) | - EvalOption(appSettings.MessageBoxRightToLeft, Win32Options.RtlReading) | - EvalOption(appSettings.MessageBoxServiceNotification, Win32Options.ServiceNotification); + private Win32Options SyncOptions() => + EvalOption(MessageBoxDefaultDesktopOnly, Win32Options.DefaultDesktopOnly) | + EvalOption(MessageBoxRightToLeft, Win32Options.RightAlign) | + EvalOption(MessageBoxRightToLeft, Win32Options.RtlReading) | + EvalOption(MessageBoxServiceNotification, Win32Options.ServiceNotification); private static Win32Options EvalOption(bool cond, Win32Options option) => cond ? option : Win32Options.None; diff --git a/src/MvvmDialogs.Wpf/DialogFactoryBase.cs b/src/MvvmDialogs.Wpf/DialogFactoryBase.cs index 11af81f..b86ac6c 100755 --- a/src/MvvmDialogs.Wpf/DialogFactoryBase.cs +++ b/src/MvvmDialogs.Wpf/DialogFactoryBase.cs @@ -36,21 +36,19 @@ protected DialogFactoryBase(IDialogFactory? chain) } /// - public Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) + public Task ShowDialogAsync(IView? owner, TSettings settings) { if (owner is not null and not ViewWrapper) throw new ArgumentException($"{nameof(owner)} must be of type {nameof(ViewWrapper)}"); - if (appSettings is not AppDialogSettings app) throw new ArgumentException($"{nameof(appSettings)} must be of type {nameof(AppDialogSettings)}"); - return ShowDialogAsync((ViewWrapper?)owner, settings, app); + return ShowDialogAsync((ViewWrapper?)owner, settings); } /// - public object? ShowDialog(IView? owner, TSettings settings, AppDialogSettingsBase appSettings) + public object? ShowDialog(IView? owner, TSettings settings) { if (owner is not null and not ViewWrapper) throw new ArgumentException($"{nameof(owner)} must be of type {nameof(ViewWrapper)}"); - if (appSettings is not AppDialogSettings app) throw new ArgumentException($"{nameof(appSettings)} must be of type {nameof(AppDialogSettings)}"); - return ShowDialog((ViewWrapper?)owner, settings, app); + return ShowDialog((ViewWrapper?)owner, settings); } /// @@ -58,10 +56,9 @@ protected DialogFactoryBase(IDialogFactory? chain) /// /// Handle to the window that owns the dialog. /// The settings for the framework dialog. - /// Application-wide settings configured on the DialogService. /// Return data specific to the dialog. - public virtual Task ShowDialogAsync(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => - Chain != null ? Chain.ShowDialogAsync(owner, settings, appSettings) : + public virtual Task ShowDialogAsync(ViewWrapper? owner, TSettings settings) => + Chain != null ? Chain.ShowDialogAsync(owner, settings) : throw new NotSupportedException($"There is no registered dialog for settings of type {typeof(TSettings).Name}."); /// @@ -69,9 +66,8 @@ protected DialogFactoryBase(IDialogFactory? chain) /// /// Handle to the window that owns the dialog. /// The settings for the framework dialog. - /// Application-wide settings configured on the DialogService. /// Return data specific to the dialog. - public virtual object? ShowDialog(ViewWrapper? owner, TSettings settings, AppDialogSettings appSettings) => - Chain != null ? Chain.AsSync().ShowDialog(owner, settings, appSettings) : + public virtual object? ShowDialog(ViewWrapper? owner, TSettings settings) => + Chain != null ? Chain.AsSync().ShowDialog(owner, settings) : throw new NotSupportedException($"There is no registered dialog for settings of type {typeof(TSettings).Name}."); } diff --git a/src/MvvmDialogs.Wpf/DialogManager.cs b/src/MvvmDialogs.Wpf/DialogManager.cs index 5d7c109..c59f3f7 100755 --- a/src/MvvmDialogs.Wpf/DialogManager.cs +++ b/src/MvvmDialogs.Wpf/DialogManager.cs @@ -34,7 +34,7 @@ public virtual void ShowDialog(INotifyPropertyChanged ownerViewModel, IModalDial } /// - public object? ShowFrameworkDialog(INotifyPropertyChanged? ownerViewModel, TSettings settings, AppDialogSettingsBase appSettings, Func? resultToString = null) + public object? ShowFrameworkDialog(INotifyPropertyChanged? ownerViewModel, TSettings settings, Func? resultToString = null) where TSettings : DialogSettingsBase { Logger?.LogInformation("Dialog: {Dialog}; Title: {Title}", settings.GetType().Name, settings.Title); @@ -44,7 +44,7 @@ public virtual void ShowDialog(INotifyPropertyChanged ownerViewModel, IModalDial { owner = FindViewByViewModelOrThrow(ownerViewModel); } - var result = DialogFactory.AsSync().ShowDialog(owner, settings, appSettings); + var result = DialogFactory.AsSync().ShowDialog(owner, settings); Logger?.LogInformation("Dialog: {Dialog}; Result: {Result}", settings?.GetType().Name, resultToString != null ? resultToString(result) : result?.ToString()); return result; diff --git a/src/MvvmDialogs.Wpf/DialogService.cs b/src/MvvmDialogs.Wpf/DialogService.cs index 6ad2c53..dee8852 100644 --- a/src/MvvmDialogs.Wpf/DialogService.cs +++ b/src/MvvmDialogs.Wpf/DialogService.cs @@ -23,14 +23,11 @@ public DialogService() /// Initializes a new instance of the class. /// /// Class responsible for UI interactions. - /// Set application-wide settings. /// Function used to create view model instances. This function is used only by and is not used internally. public DialogService( IDialogManager? dialogManager = null, - AppDialogSettings? settings = null, Func? viewModelFactory = null) - : base(settings ?? new AppDialogSettings(), - dialogManager ?? new DialogManager(dialogFactory: new DialogFactory()), + : base(dialogManager ?? new DialogManager(dialogFactory: new DialogFactory()), viewModelFactory) { } diff --git a/src/MvvmDialogs.Wpf/DialogServiceExtensions.cs b/src/MvvmDialogs.Wpf/DialogServiceExtensions.cs index c39f1ee..974e0d6 100644 --- a/src/MvvmDialogs.Wpf/DialogServiceExtensions.cs +++ b/src/MvvmDialogs.Wpf/DialogServiceExtensions.cs @@ -65,7 +65,6 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = /// A value that specifies the icon to display. /// Default value is . /// Specifies the value of the button selected by default. Default value is true. - /// Overrides application-wide settings configured on . /// A value that specifies which message box button is clicked by the user. True=OK/Yes, False=No, Null=Cancel /// No view is registered with specified owner view model as data context. public static bool? ShowMessageBox( @@ -75,8 +74,7 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = string title = "", MessageBoxButton button = MessageBoxButton.Ok, MessageBoxImage icon = MessageBoxImage.None, - bool? defaultResult = true, - AppDialogSettingsBase? appSettings = null) + bool? defaultResult = true) { var settings = new MessageBoxSettings { @@ -87,7 +85,7 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = DefaultValue = defaultResult }; - return ShowMessageBox(service, ownerViewModel, settings, appSettings ?? service.AppSettings); + return ShowMessageBox(service, ownerViewModel, settings); } /// @@ -97,14 +95,13 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the message box dialog. - /// Overrides application-wide settings configured on . /// A value that specifies which message box button is clicked by the user. True=OK/Yes, False=No, Null=Cancel /// No view is registered with specified owner view model as data context. public static bool? ShowMessageBox(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - MessageBoxSettings? settings = null, AppDialogSettingsBase? appSettings = null) + MessageBoxSettings? settings = null) { return (bool?)service.DialogManager.AsSync().ShowFrameworkDialog( - ownerViewModel, settings ?? new MessageBoxSettings(), appSettings ?? service.AppSettings); + ownerViewModel, settings ?? new MessageBoxSettings()); } /// @@ -113,15 +110,14 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the open file dialog. - /// Overrides application-wide settings configured on . /// The file selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static IDialogStorageFile? ShowOpenFileDialog(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFileDialogSettings? settings = null) { settings ??= new OpenFileDialogSettings(); settings.AllowMultiple ??= false; - return ShowOpenFilesDialog(service, ownerViewModel, settings, appSettings).FirstOrDefault(); + return ShowOpenFilesDialog(service, ownerViewModel, settings).FirstOrDefault(); } /// @@ -130,16 +126,15 @@ public static DialogResult ShowDialog(this CommonDialog dialog, Window? owner) = /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the open file dialog. - /// Overrides application-wide settings configured on . /// The list of files selected by the user, or empty if the user cancelled. /// No view is registered with specified owner view model as data context. public static IReadOnlyList ShowOpenFilesDialog(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFileDialogSettings? settings = null) { settings ??= new OpenFileDialogSettings(); settings.AllowMultiple ??= true; return service.DialogManager.AsSync().ShowFrameworkDialog( - ownerViewModel, settings, appSettings ?? service.AppSettings, x => string.Join(", ", x)) as IReadOnlyList ?? Array.Empty(); + ownerViewModel, settings, x => string.Join(", ", x)) as IReadOnlyList ?? Array.Empty(); } /// @@ -148,14 +143,13 @@ public static IReadOnlyList ShowOpenFilesDialog(this IDialog /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the save file dialog. - /// Overrides application-wide settings configured on . /// The file selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static IDialogStorageFile? ShowSaveFileDialog(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - SaveFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + SaveFileDialogSettings? settings = null) { return (IDialogStorageFile?)service.DialogManager.AsSync().ShowFrameworkDialog( - ownerViewModel, settings ?? new SaveFileDialogSettings(), appSettings ?? service.AppSettings); + ownerViewModel, settings ?? new SaveFileDialogSettings()); } /// @@ -164,13 +158,12 @@ public static IReadOnlyList ShowOpenFilesDialog(this IDialog /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the folder browser dialog. - /// Overrides application-wide settings configured on . /// The folder selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static IDialogStorageFolder? ShowOpenFolderDialog(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFolderDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFolderDialogSettings? settings = null) { return ((IReadOnlyList?)service.DialogManager.AsSync().ShowFrameworkDialog( - ownerViewModel, settings ?? new OpenFolderDialogSettings(), appSettings ?? service.AppSettings)).FirstOrDefault(); + ownerViewModel, settings ?? new OpenFolderDialogSettings())).FirstOrDefault(); } } diff --git a/src/MvvmDialogs.Wpf/IDialogFactorySync.cs b/src/MvvmDialogs.Wpf/IDialogFactorySync.cs index cd2386d..5bf024c 100755 --- a/src/MvvmDialogs.Wpf/IDialogFactorySync.cs +++ b/src/MvvmDialogs.Wpf/IDialogFactorySync.cs @@ -10,7 +10,6 @@ public interface IDialogFactorySync /// /// Handle to the window that owns the dialog. /// The settings for the framework dialog. - /// Application-wide settings configured on the DialogService. /// Return data specific to the dialog. - object? ShowDialog(IView? owner, TSettings settings, AppDialogSettingsBase appSettings); + object? ShowDialog(IView? owner, TSettings settings); } diff --git a/src/MvvmDialogs.Wpf/IDialogManagerSync.cs b/src/MvvmDialogs.Wpf/IDialogManagerSync.cs index 0e7e00d..2913dd0 100755 --- a/src/MvvmDialogs.Wpf/IDialogManagerSync.cs +++ b/src/MvvmDialogs.Wpf/IDialogManagerSync.cs @@ -20,10 +20,9 @@ public interface IDialogManagerSync /// /// A view model that represents the owner window of the dialog. /// The settings to pass to the - /// Application-wide settings configured on the DialogService. /// A function to convert the result into a string for logging. If null, ToString will be used. /// The settings type used to determine which dialog to show. /// The dialog result. - object? ShowFrameworkDialog(INotifyPropertyChanged? ownerViewModel, TSettings settings, AppDialogSettingsBase appSettings, Func? resultToString = null) + object? ShowFrameworkDialog(INotifyPropertyChanged? ownerViewModel, TSettings settings, Func? resultToString = null) where TSettings : DialogSettingsBase; } diff --git a/src/MvvmDialogs.Wpf/MvvmDialogs.Wpf.csproj b/src/MvvmDialogs.Wpf/MvvmDialogs.Wpf.csproj index 6629b0f..52a8fd3 100644 --- a/src/MvvmDialogs.Wpf/MvvmDialogs.Wpf.csproj +++ b/src/MvvmDialogs.Wpf/MvvmDialogs.Wpf.csproj @@ -2,7 +2,7 @@ - net461;netcoreapp3.1 + net462;netcoreapp3.1 default enable Library diff --git a/src/MvvmDialogs/AppDialogSettingsBase.cs b/src/MvvmDialogs/AppDialogSettingsBase.cs deleted file mode 100644 index 2acb946..0000000 --- a/src/MvvmDialogs/AppDialogSettingsBase.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace HanumanInstitute.MvvmDialogs; - -/// -/// Base class for platform-specific application settings. -/// -public abstract class AppDialogSettingsBase -{ - /// - /// Gets or sets whether multiple dialogs can be shown at the same time. - /// If false (default), it will wait for the previous dialog to close before showing the next one. - /// - public bool AllowConcurrentDialogs { get; set; } -} diff --git a/src/MvvmDialogs/DialogManagerBase.cs b/src/MvvmDialogs/DialogManagerBase.cs index d27cd8e..9372e07 100755 --- a/src/MvvmDialogs/DialogManagerBase.cs +++ b/src/MvvmDialogs/DialogManagerBase.cs @@ -22,11 +22,12 @@ public abstract class DialogManagerBase : IDialogManager /// protected IDialogFactory DialogFactory { get; } - /// - /// A ILogger to capture MvvmDialogs logs. - /// + /// public ILogger? Logger { get; } + /// + public bool AllowConcurrentDialogs { get; set; } + /// /// Initializes a new instance of the DisplayManager class. /// @@ -231,15 +232,14 @@ public async void View_Closing(IView dialog, CancelEventArgs e) public virtual async Task ShowFrameworkDialogAsync( INotifyPropertyChanged? ownerViewModel, TSettings settings, - AppDialogSettingsBase appSettings, Func? resultToString = null) where TSettings : DialogSettingsBase { - if (!appSettings.AllowConcurrentDialogs) + if (!AllowConcurrentDialogs) { await _semaphoreShow.WaitAsync(); } - + try { Logger?.LogInformation("Dialog: {Dialog}; Title: {Title}", settings.GetType().Name, settings.Title); @@ -264,8 +264,8 @@ public async void View_Closing(IView dialog, CancelEventArgs e) isDummyOwner = true; } } - - var result = await DialogFactory.ShowDialogAsync(owner, settings, appSettings).ConfigureAwait(true); + + var result = await DialogFactory.ShowDialogAsync(owner, settings).ConfigureAwait(true); if (isDummyOwner) { owner!.Close(); @@ -278,7 +278,7 @@ public async void View_Closing(IView dialog, CancelEventArgs e) } finally { - if (!appSettings.AllowConcurrentDialogs) + if (!AllowConcurrentDialogs) { _semaphoreShow.Release(); } diff --git a/src/MvvmDialogs/DialogServiceBase.cs b/src/MvvmDialogs/DialogServiceBase.cs index 40626ca..81b00fb 100644 --- a/src/MvvmDialogs/DialogServiceBase.cs +++ b/src/MvvmDialogs/DialogServiceBase.cs @@ -11,22 +11,15 @@ public abstract class DialogServiceBase : IDialogService /// /// Initializes a new instance of the class. /// - /// Set application-wide settings. /// Class responsible to manage UI interactions. /// Function used to create view model instances. This function is used only by and is not used internally. - protected DialogServiceBase(AppDialogSettingsBase appSettings, IDialogManager dialogManager, + protected DialogServiceBase(IDialogManager dialogManager, Func? viewModelFactory) { - AppSettings = appSettings; DialogManager = dialogManager; ViewModelFactory = viewModelFactory; } - /// - /// Set application-wide settings. - /// - public AppDialogSettingsBase AppSettings { get; } - /// /// Factory responsible for creating dialogs. /// diff --git a/src/MvvmDialogs/DialogServiceExtensions.cs b/src/MvvmDialogs/DialogServiceExtensions.cs index 0768b65..1d8a9e6 100644 --- a/src/MvvmDialogs/DialogServiceExtensions.cs +++ b/src/MvvmDialogs/DialogServiceExtensions.cs @@ -24,7 +24,6 @@ public static class DialogServiceExtensions /// A value that specifies the icon to display. /// Default value is . /// Specifies the value of the button selected by default. Default value is true. - /// Overrides application-wide settings configured on . /// A value that specifies which message box button is clicked by the user. True=OK/Yes, False=No, Null=Cancel /// No view is registered with specified owner view model as data context. public static Task ShowMessageBoxAsync( @@ -34,8 +33,7 @@ public static class DialogServiceExtensions string title = "", MessageBoxButton button = MessageBoxButton.Ok, MessageBoxImage icon = MessageBoxImage.None, - bool? defaultResult = true, - AppDialogSettingsBase? appSettings = null) + bool? defaultResult = true) { var settings = new MessageBoxSettings { @@ -46,7 +44,7 @@ public static class DialogServiceExtensions DefaultValue = defaultResult }; - return ShowMessageBoxAsync(service, ownerViewModel, settings, appSettings ?? service.AppSettings); + return ShowMessageBoxAsync(service, ownerViewModel, settings); } /// @@ -56,14 +54,13 @@ public static class DialogServiceExtensions /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the message box dialog. - /// Overrides application-wide settings configured on . /// A value that specifies which message box button is clicked by the user. True=OK/Yes, False=No, Null=Cancel /// No view is registered with specified owner view model as data context. public static async Task ShowMessageBoxAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - MessageBoxSettings? settings = null, AppDialogSettingsBase? appSettings = null) + MessageBoxSettings? settings = null) { return (bool?)await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings ?? new MessageBoxSettings(), appSettings ?? service.AppSettings).ConfigureAwait(true); + ownerViewModel, settings ?? new MessageBoxSettings()).ConfigureAwait(true); } /// @@ -72,15 +69,14 @@ public static class DialogServiceExtensions /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the open file dialog. - /// Overrides application-wide settings configured on . /// The file selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static async Task ShowOpenFileDialogAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFileDialogSettings? settings = null) { settings ??= new OpenFileDialogSettings(); settings.AllowMultiple ??= false; - var result = await ShowOpenFilesDialogAsync(service, ownerViewModel, settings, appSettings).ConfigureAwait(true); + var result = await ShowOpenFilesDialogAsync(service, ownerViewModel, settings).ConfigureAwait(true); return result.Count > 0 ? result[0] : null; } @@ -90,16 +86,15 @@ public static class DialogServiceExtensions /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the open file dialog. - /// Overrides application-wide settings configured on . /// The list of files selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static async Task> ShowOpenFilesDialogAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFileDialogSettings? settings = null) { settings ??= new OpenFileDialogSettings(); settings.AllowMultiple ??= true; return (IReadOnlyList)(await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings, appSettings ?? service.AppSettings, x => string.Join(", ", x)).ConfigureAwait(true))!; + ownerViewModel, settings, x => string.Join(", ", x)).ConfigureAwait(true))!; } /// @@ -108,14 +103,13 @@ public static async Task> ShowOpenFilesDialogA /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the save file dialog. - /// Overrides application-wide settings configured on . /// The path to the file selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static async Task ShowSaveFileDialogAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - SaveFileDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + SaveFileDialogSettings? settings = null) { return (IDialogStorageFile?)await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings ?? new SaveFileDialogSettings(), appSettings ?? service.AppSettings).ConfigureAwait(true); + ownerViewModel, settings ?? new SaveFileDialogSettings()).ConfigureAwait(true); } /// @@ -124,14 +118,13 @@ public static async Task> ShowOpenFilesDialogA /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the folder browser dialog. - /// Overrides application-wide settings configured on . /// The path of the folder selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static async Task> ShowOpenFoldersDialogAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFolderDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFolderDialogSettings? settings = null) { return (IReadOnlyList)(await service.DialogManager.ShowFrameworkDialogAsync( - ownerViewModel, settings ?? new OpenFolderDialogSettings(), appSettings ?? service.AppSettings).ConfigureAwait(true))!; + ownerViewModel, settings ?? new OpenFolderDialogSettings()).ConfigureAwait(true))!; } /// @@ -140,15 +133,14 @@ public static async Task> ShowOpenFoldersDia /// The IDialogService on which to attach the extension method. /// A view model that represents the owner window of the dialog. /// The settings for the folder browser dialog. - /// Overrides application-wide settings configured on . /// The path of the folder selected by the user, or null if the user cancelled. /// No view is registered with specified owner view model as data context. public static async Task ShowOpenFolderDialogAsync(this IDialogService service, INotifyPropertyChanged? ownerViewModel, - OpenFolderDialogSettings? settings = null, AppDialogSettingsBase? appSettings = null) + OpenFolderDialogSettings? settings = null) { settings ??= new OpenFolderDialogSettings(); settings.AllowMultiple ??= false; - var result = await ShowOpenFoldersDialogAsync(service, ownerViewModel, settings, appSettings).ConfigureAwait(true); + var result = await ShowOpenFoldersDialogAsync(service, ownerViewModel, settings).ConfigureAwait(true); return result?.FirstOrDefault(); } } diff --git a/src/MvvmDialogs/IDialogFactory.cs b/src/MvvmDialogs/IDialogFactory.cs index 4bca1c3..bf779a9 100644 --- a/src/MvvmDialogs/IDialogFactory.cs +++ b/src/MvvmDialogs/IDialogFactory.cs @@ -10,10 +10,9 @@ public interface IDialogFactory /// /// Handle to the window that owns the dialog. /// The settings for the framework dialog. - /// Application-wide settings configured on the DialogService. /// The type of settings to use for this dialog. /// Return data specific to the dialog. - Task ShowDialogAsync(IView? owner, TSettings settings, AppDialogSettingsBase appSettings); + Task ShowDialogAsync(IView? owner, TSettings settings); /// /// Gets or sets a reference to the . Will only be set to the root factory in the chain. diff --git a/src/MvvmDialogs/IDialogManager.cs b/src/MvvmDialogs/IDialogManager.cs index 27c60ab..8fd35ee 100755 --- a/src/MvvmDialogs/IDialogManager.cs +++ b/src/MvvmDialogs/IDialogManager.cs @@ -11,6 +11,11 @@ public interface IDialogManager /// Gets the ILogger that captures MvvmDialogs logs. /// ILogger? Logger { get; } + + /// + /// Whether to allow multiple framework dialogs to be displayed at once. + /// + public bool AllowConcurrentDialogs { get; set; } /// /// Shows a new window of specified type. @@ -32,11 +37,10 @@ public interface IDialogManager /// /// A view model that represents the owner window of the dialog. /// The settings to pass to the - /// Application-wide settings configured on the DialogService. /// A function to convert the result into a string for logging. If null, ToString will be used. /// The settings type used to determine which dialog to show. /// The dialog result. - Task ShowFrameworkDialogAsync(INotifyPropertyChanged? ownerViewModel, TSettings settings, AppDialogSettingsBase appSettings, Func? resultToString = null) + Task ShowFrameworkDialogAsync(INotifyPropertyChanged? ownerViewModel, TSettings settings, Func? resultToString = null) where TSettings : DialogSettingsBase; /// diff --git a/src/MvvmDialogs/IDialogService.cs b/src/MvvmDialogs/IDialogService.cs index 58f24c4..e450a45 100644 --- a/src/MvvmDialogs/IDialogService.cs +++ b/src/MvvmDialogs/IDialogService.cs @@ -12,11 +12,6 @@ public interface IDialogService /// IDialogManager DialogManager { get; } - /// - /// Set application-wide settings. - /// - AppDialogSettingsBase AppSettings { get; } - /// /// Displays a non-modal dialog of a type that is determined by the dialog type locator. ///