A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Added dialog component
Etienne Baudoux607fbd6db606
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/UIDialog.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIDialog.csnew file mode 100644index 000000000..7a020086e--- /dev/null+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIDialog.cs@@ -0,0 +1,38 @@+namespace DevToys.Api;++public sealed class UIDialog : IDisposable+{+ internal UIDialog(IUIElement dialogContent, bool isDismissible)+ : this(dialogContent, null, isDismissible)+ {+ }++ internal UIDialog(IUIElement dialogContent, IUIElement? footerContent, bool isDismissible)+ {+ DialogContent = dialogContent;+ FooterContent = footerContent;+ IsDismissible = isDismissible;+ IsOpened = true;+ }++ public bool IsOpened { get; private set; }++ public bool IsDismissible { get; }++ public IUIElement? DialogContent { get; }++ public IUIElement? FooterContent { get; }++ public event EventHandler? IsOpenedChanged;++ public void Close()+ {+ IsOpened = false;+ IsOpenedChanged?.Invoke(this, EventArgs.Empty);+ }++ public void Dispose()+ {+ Close();+ }+}diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.csindex f9a1e147d..c29137798 100644--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs@@ -8,13 +8,23 @@ namespace DevToys.Api;[DebuggerDisplay($"RootElement = {{{nameof(RootElement)}}}, IsScrollable = {{{nameof(IsScrollable)}}}")]public class UIToolView : INotifyPropertyChanged{+ private UIDialog? _currentOpenedDialog;+ private IUIElement? _rootElement;private bool _isScrollable;+ /// <summary>+ /// Creates a new instance of the <see cref="UIToolView"/> class.+ /// </summary>+ public UIToolView()+ : this(true, null)+ {+ }+/// <summary>/// Creates a new instance of the <see cref="UIToolView"/> class./// </summary>/// <param name="rootElement">The root element of the tool's UI.</param>- public UIToolView(IUIElement rootElement)+ public UIToolView(IUIElement? rootElement): this(true, rootElement){}@@ -24,7 +34,17 @@ public class UIToolView : INotifyPropertyChanged/// </summary>/// <param name="isScrollable">Indicates whether the UI of the tool is scrollable or should fits to the window boundaries.</param>/// <param name="rootElement">The root element of the tool's UI.</param>- public UIToolView(bool isScrollable, IUIElement rootElement)+ public UIToolView(bool isScrollable)+ : this(isScrollable, null)+ {+ }++ /// <summary>+ /// Creates a new instance of the <see cref="UIToolView"/> class.+ /// </summary>+ /// <param name="isScrollable">Indicates whether the UI of the tool is scrollable or should fits to the window boundaries.</param>+ /// <param name="rootElement">The root element of the tool's UI.</param>+ public UIToolView(bool isScrollable, IUIElement? rootElement){IsScrollable = isScrollable;RootElement = rootElement;@@ -39,15 +59,88 @@ public class UIToolView : INotifyPropertyChangedinternal set => SetPropertyValue(ref _isScrollable, value, IsScrollableChanged);}+ /// <summary>+ /// Gets the <see cref="UIDialog"/> currently opened. Only one at a time can be opened.+ /// </summary>+ public UIDialog? CurrentOpenedDialog+ {+ get => _currentOpenedDialog;+ internal set => SetPropertyValue(ref _currentOpenedDialog, value, CurrentOpenedDialogChanged);+ }+/// <summary>/// Gets the root element of the tool's UI./// </summary>- public IUIElement RootElement { get; }+ public IUIElement? RootElement+ {+ get => _rootElement;+ internal set => SetPropertyValue(ref _rootElement, value, RootElementChanged);+ }+ /// <summary>+ /// Raised when <see cref="IsScrollable"/> changed.+ /// </summary>public event EventHandler? IsScrollableChanged;+ /// <summary>+ /// Raised when <see cref="CurrentOpenedDialog"/> changed.+ /// </summary>+ public event EventHandler? CurrentOpenedDialogChanged;++ /// <summary>+ /// Raised when <see cref="RootElement"/> changed.+ /// </summary>+ public event EventHandler? RootElementChanged;+public event PropertyChangedEventHandler? PropertyChanged;+ /// <summary>+ /// Shows the dialog box in the UI. Only one dialog can be opened at a time.+ /// </summary>+ /// <param name="dialogContent">The element to display in the dialog.</param>+ /// <param name="isDismissible">Indicates whether the dialog can be closed by clicking outside of the dialog.</param>+ /// <returns>An instance of the opened dialog.</returns>+ public UIDialog OpenDialog(+ IUIElement dialogContent,+ bool isDismissible)+ {+ return OpenDialog(dialogContent, null, isDismissible);+ }++ /// <summary>+ /// Shows the dialog box in the UI. Only one dialog can be opened at a time.+ /// </summary>+ /// <param name="dialogContent">The element to display in the dialog.</param>+ /// <param name="footerContent">The element to display in the dialog footer.</param>+ /// <param name="isDismissible">Indicates whether the dialog can be closed by clicking outside of the dialog.</param>+ /// <returns>An instance of the opened dialog.</returns>+ public UIDialog OpenDialog(+ IUIElement dialogContent,+ IUIElement? footerContent,+ bool isDismissible)+ {+ if (CurrentOpenedDialog is not null)+ {+ ThrowHelper.ThrowInvalidOperationException("A dialog is already opened. Close it before opening another one.");+ }++ var dialog = new UIDialog(dialogContent, footerContent, isDismissible);+ dialog.IsOpenedChanged += Dialog_IsOpenedChanged;+ CurrentOpenedDialog = dialog;+ return dialog;+ }++ private void Dialog_IsOpenedChanged(object? sender, EventArgs e)+ {+ Guard.IsNotNull(CurrentOpenedDialog);+ if (!CurrentOpenedDialog.IsOpened)+ {+ CurrentOpenedDialog.IsOpenedChanged -= Dialog_IsOpenedChanged;+ CurrentOpenedDialog.Dispose();+ CurrentOpenedDialog = null;+ }+ }+protected void SetPropertyValue<T>(ref T field,T value,@@ -67,3 +160,15 @@ public class UIToolView : INotifyPropertyChangedPropertyChanged?.Invoke(this, new(propertyName));}}++public static partial class GUI+{+ /// <summary>+ /// Sets the element to be displayed in the view.+ /// </summary>+ public static UIToolView WithRootElement(this UIToolView toolView, IUIElement? rootElement)+ {+ toolView.RootElement = rootElement;+ return toolView;+ }+}diff --git a/src/app/dev/DevToys.Blazor/Assets/sass/theme/windows/dark.scss b/src/app/dev/DevToys.Blazor/Assets/sass/theme/windows/dark.scssindex 283142101..2890f0140 100644--- a/src/app/dev/DevToys.Blazor/Assets/sass/theme/windows/dark.scss+++ b/src/app/dev/DevToys.Blazor/Assets/sass/theme/windows/dark.scss@@ -367,6 +367,13 @@--data-grid-row-selected-background-pointer-over: rgba(var(--accent-base), 0.8);--data-grid-border: var(--control-stroke-color-default);+ /* Dialog */+ --dialog-light-dismiss-overlay-background: rgba(0, 0, 0, 0.305);+ --dialog-shadow: 0px 30px 38px -3px rgba(0,0,0,0.24);+ --dialog-background-color: rgb(43, 43, 43);+ --dialog-footer-background-color: rgb(32, 32, 32);+ --dialog-border-color: var(--control-stroke-color-default);+/* UISettingGroup */--ui-setting-group-presenter-inner-ui-setting-background-color: transparent;diff --git a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razornew file mode 100644index 000000000..71e5761f6--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor@@ -0,0 +1,56 @@+@namespace DevToys.Blazor.Components+@inherits StyledComponentBase++@if (IsOpen)+{+ <!-- Overlay that covers the whole window for dialog -->+ <Overlay ZIndex="20000"+ Visible="true"+ Class="dialog-overlay dialog-overlay-dim"+ OnClick="@OnDismiss" />++ <div id="@Id" class="dialog-container">+ <div @ref="@Element"+ class="dialog dialog-auto-height @FinalCssClasses"+ style="@Style"+ @attributes="AdditionalAttributes">+ <FocusTrapper OnEscapeKeyPressed="@OnDismiss" Class="dialog-auto-height">+ <Container Width="@Width"+ Height="@Height"+ VerticalAlignment="UIVerticalAlignment.Stretch"+ IsEnabled="@IsEnabled">+ <Grid VerticalAlignment="UIVerticalAlignment.Stretch"+ Rows="@(new List<UIGridLength>+ {+ new UIGridLength(1, UIGridUnitType.Fraction),+ UIGridLength.Auto+ })">+ <GridCell Row="0">+ <ScrollViewer Orientation="UIOrientation.Vertical">+ <Container PaddingLeft="24"+ PaddingRight="24"+ PaddingTop="24"+ PaddingBottom="24">+ @Content+ </Container>+ </ScrollViewer>+ </GridCell>+ <GridCell Row="1">+ @if (Footer is not null)+ {+ <div class="dialog-footer">+ <Container PaddingLeft="24"+ PaddingRight="24"+ PaddingTop="24"+ PaddingBottom="24">+ @Footer+ </Container>+ </div>+ }+ </GridCell>+ </Grid>+ </Container>+ </FocusTrapper>+ </div>+ </div>+}\ No newline at end of filediff --git a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.cs b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.csnew file mode 100644index 000000000..4f7f2fda8--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.cs@@ -0,0 +1,40 @@+namespace DevToys.Blazor.Components;++public partial class Dialog : StyledComponentBase+{+ /// <summary>+ /// Gets or sets the content to be rendered inside the component.+ /// </summary>+ [Parameter]+ public RenderFragment? Content { get; set; }++ /// <summary>+ /// Gets or sets the content to be rendered inside the component.+ /// </summary>+ [Parameter]+ public RenderFragment? Footer { get; set; }++ [Parameter]+ public bool IsOpen { get; set; }++ [Parameter]+ public bool Dismissible { get; set; }++ /// <summary>+ /// Raised when the dialog got dismissed.+ /// </summary>+ [Parameter]+ public EventCallback OnDismissed { get; set; }++ private void OnDismiss()+ {+ if (Dismissible)+ {+ IsOpen = false;+ if (OnDismissed.HasDelegate)+ {+ OnDismissed.InvokeAsync();+ }+ }+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.scss b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.scssnew file mode 100644index 000000000..aa988871a--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.scss@@ -0,0 +1,88 @@+.dialog {+ border: solid 1px var(--dialog-border-color);+ border-radius: var(--overlay-corner-radius);+ background-color: var(--dialog-background-color);+ -webkit-box-shadow: var(--dialog-shadow);+ box-shadow: var(--dialog-shadow);+ animation: dialog-open-animation 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) both;++ &-auto-height {+ display: grid;+ min-height: 200px;+ min-width: 300px;+ max-width: calc(100vh - 128px);+ max-height: calc(100vh - 64px);+ }++ &-footer {+ background-color: var(--dialog-footer-background-color);+ border-bottom-right-radius: var(--overlay-corner-radius);+ border-bottom-left-radius: var(--overlay-corner-radius);+ }++ &-overlay {+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ border-radius: inherit;+ position: absolute;+ height: 100%;+ width: 100%;+ border-color: transparent;+ animation: dialog-overlay-fadein-animation ease 0.25s;+ -webkit-animation: dialog-overlay-fadein-animation ease 0.25s;+ -moz-animation: dialog-overlay-fadein-animation ease 0.25s;+ -o-animation: dialog-overlay-fadein-animation ease 0.25s;++ &-dim {+ background-color: var(--dialog-light-dismiss-overlay-background) !important;+ }+ }++ &-container {+ display: flex;+ position: fixed;+ top: 0;+ z-index: calc(20000 + 10);+ align-items: center;+ justify-content: center;+ box-sizing: border-box;+ margin: 0;+ padding: 0;+ top: 0;+ left: 0;+ bottom: 0;+ right: 0;+ background: none;+ pointer-events: none;++ * {+ pointer-events: auto;+ }+ }+}++@keyframes dialog-overlay-fadein-animation {+ 0% {+ opacity: 0;+ }++ 100% {+ opacity: 1;+ }+}++@keyframes dialog-open-animation {+ 0% {+ -webkit-transform: scale(1.25);+ transform: scale(1.25);+ opacity: 0;+ }++ 100% {+ -webkit-transform: scale(1);+ transform: scale(1);+ opacity: 1;+ }+}diff --git a/src/app/dev/DevToys.Blazor/Components/Layout/FocusTrapper/FocusTrapper.razor b/src/app/dev/DevToys.Blazor/Components/Layout/FocusTrapper/FocusTrapper.razorindex 661ec1b08..e831ab7fb 100644--- a/src/app/dev/DevToys.Blazor/Components/Layout/FocusTrapper/FocusTrapper.razor+++ b/src/app/dev/DevToys.Blazor/Components/Layout/FocusTrapper/FocusTrapper.razor@@ -2,6 +2,7 @@@inherits JSStyledComponentBase<div @ref="Element"+ class="@FinalCssClasses"style="@Style"tabindex="-1"@onkeydown="@OnKeyDown">diff --git a/src/app/dev/DevToys.Blazor/Components/Layout/Overlay/Overlay.razor.scss b/src/app/dev/DevToys.Blazor/Components/Layout/Overlay/Overlay.razor.scssindex 8876f2818..c9ccfacaf 100644--- a/src/app/dev/DevToys.Blazor/Components/Layout/Overlay/Overlay.razor.scss+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Overlay/Overlay.razor.scss@@ -18,7 +18,7 @@position: absolute;}- & .overlay-content {+ .overlay-content {position: relative;}}diff --git a/src/app/dev/DevToys.Blazor/Core/Services/DialogService.cs b/src/app/dev/DevToys.Blazor/Core/Services/DialogService.csnew file mode 100644index 000000000..b333bd8d1--- /dev/null+++ b/src/app/dev/DevToys.Blazor/Core/Services/DialogService.cs@@ -0,0 +1,49 @@+namespace DevToys.Blazor.Core.Services;++public sealed class DialogService+{+ private readonly object _lock = new();++ internal bool IsDialogOpened { get; private set; }++ internal bool IsDismissible { get; private set; }++ internal RenderFragment? DialogContent { get; set; }++ internal RenderFragment? FooterContent { get; set; }++ internal event EventHandler? IsDialogOpenedChanged;++ internal event EventHandler? CloseDialogRequested;++ internal bool TryOpenDialog(bool isDismissible)+ {+ lock (_lock)+ {+ if (IsDialogOpened)+ {+ // Only one context menu should open at the same time.+ return false;+ }++ IsDismissible = isDismissible;+ IsDialogOpened = true;+ IsDialogOpenedChanged?.Invoke(this, EventArgs.Empty);+ return true;+ }+ }++ internal void CloseDialog()+ {+ lock (_lock)+ {+ IsDialogOpened = false;+ IsDialogOpenedChanged?.Invoke(this, EventArgs.Empty);+ }+ }++ internal void OnCloseDialogRequested()+ {+ CloseDialogRequested?.Invoke(this, EventArgs.Empty);+ }+}diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor b/src/app/dev/DevToys.Blazor/Pages/Index.razorindex 6d1b895a0..f15a26b24 100644--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor@@ -8,6 +8,20 @@@inherits MefComponentBase<CascadingValue Value="this" IsFixed="true">+ @if (DialogService.IsDialogOpened)+ {+ <Dialog IsOpen="@DialogService.IsDialogOpened"+ Dismissible="@DialogService.IsDismissible"+ OnDismissed="@(() => DialogService.OnCloseDialogRequested())">+ <Content>+ @DialogService.DialogContent+ </Content>+ <Footer>+ @DialogService.FooterContent+ </Footer>+ </Dialog>+ }+<!-- Provider for popover --><PopoverProvider />diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs b/src/app/dev/DevToys.Blazor/Pages/Index.razor.csindex ea1212d8d..7d1709fcf 100644--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs@@ -31,6 +31,9 @@ public partial class Index : MefComponentBase[Inject]internal ContextMenuService ContextMenuService { get; set; } = default!;+ [Inject]+ internal DialogService DialogService { get; set; } = default!;+[Inject]internal IWindowService WindowService { get; set; } = default!;@@ -45,6 +48,7 @@ public partial class Index : MefComponentBaseprotected override void OnInitialized(){base.OnInitialized();+ DialogService.IsDialogOpenedChanged += DialogService_IsDialogOpenedChanged;ViewModel.SelectedMenuItemChanged += ViewModel_SelectedMenuItemChanged;ViewModel.SelectedMenuItem ??= ViewModel.HeaderAndBodyToolViewItems[0];ContextMenuService.IsContextMenuOpenedChanged += ContextMenuService_IsContextMenuOpenedChanged;@@ -56,6 +60,11 @@ public partial class Index : MefComponentBaseWindowHasFocus = true;}+ private void DialogService_IsDialogOpenedChanged(object? sender, EventArgs e)+ {+ StateHasChanged();+ }+private void ViewModel_SelectedMenuItemChanged(object? sender, EventArgs e){// This will force the page content to clear our, disposing the current tool group or tool component before creating a new one, insteaddiff --git a/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor b/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razorindex f029f4e85..9f3ff2adb 100644--- a/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor+++ b/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor@@ -12,6 +12,22 @@protected override Task OnInitializedAsync(){+ DialogService.DialogContent = (__builder) =>+ {+ @if (ViewModel.ToolView.CurrentOpenedDialog is not null)+ {+ <UIElementPresenter UIElement="@ViewModel.ToolView.CurrentOpenedDialog.DialogContent" />+ }+ };++ DialogService.FooterContent = (__builder) =>+ {+ @if (ViewModel.ToolView.CurrentOpenedDialog is not null)+ {+ <UIElementPresenter UIElement="@ViewModel.ToolView.CurrentOpenedDialog.FooterContent" />+ }+ };+RenderToolWithHeader = (bool isScrollable) => (__builder) =>{<Grid RowSpacing="12"diff --git a/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor.cs b/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor.csindex f8b7e6c18..37d6b8826 100644--- a/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor.cs+++ b/src/app/dev/DevToys.Blazor/Pages/SubPages/ToolPage.razor.cs@@ -10,6 +10,9 @@ public partial class ToolPage : MefComponentBase, IDisposable[Inject]internal IWindowService WindowService { get; set; } = default!;+ [Inject]+ internal DialogService DialogService { get; set; } = default!;+[Import]internal ToolPageViewModel ViewModel { get; set; } = default!;@@ -25,6 +28,7 @@ public partial class ToolPage : MefComponentBase, IDisposableprotected override void OnInitialized(){base.OnInitialized();+ DialogService.CloseDialogRequested += DialogService_CloseDialogRequested;}protected override void OnParametersSet()@@ -38,15 +42,19 @@ public partial class ToolPage : MefComponentBase, IDisposable{ViewModel.ToolView.PropertyChanged -= ToolView_PropertyChanged;ViewModel.ToolView.PropertyChanged += ToolView_PropertyChanged;+ ViewModel.ToolView.CurrentOpenedDialogChanged -= ToolView_CurrentOpenedDialogChanged;+ ViewModel.ToolView.CurrentOpenedDialogChanged += ToolView_CurrentOpenedDialogChanged;}}}public void Dispose(){+ DialogService.CloseDialogRequested -= DialogService_CloseDialogRequested;if (ViewModel.ToolView is not null){ViewModel.ToolView.PropertyChanged -= ToolView_PropertyChanged;+ ViewModel.ToolView.CurrentOpenedDialogChanged -= ToolView_CurrentOpenedDialogChanged;}GC.SuppressFinalize(this);}@@ -56,6 +64,30 @@ public partial class ToolPage : MefComponentBase, IDisposableStateHasChanged();}+ private void ToolView_CurrentOpenedDialogChanged(object? sender, EventArgs e)+ {+ if (ViewModel.ToolView.CurrentOpenedDialog is null)+ {+ DialogService.CloseDialog();+ }+ else+ {+ ViewModel.ToolView.CurrentOpenedDialog.IsOpenedChanged += DialogService_CloseDialogRequested;+ DialogService.TryOpenDialog(ViewModel.ToolView.CurrentOpenedDialog.IsDismissible);+ }+ }++ private void DialogService_CloseDialogRequested(object? sender, EventArgs e)+ {+ if (ViewModel.ToolView.CurrentOpenedDialog is not null)+ {+ ViewModel.ToolView.CurrentOpenedDialog.IsOpenedChanged -= DialogService_CloseDialogRequested;+ }++ DialogService.CloseDialog();+ ViewModel.ToolView.CurrentOpenedDialog?.Close();+ }+private void OnIsInFullScreenModeChanged(bool isInFullScreenMode){IsInFullScreenMode = isInFullScreenMode;diff --git a/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs b/src/app/dev/DevToys.Core/Tools/GuiToolInstance.csindex bf1b7a665..e8e91b7c0 100644--- a/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs+++ b/src/app/dev/DevToys.Core/Tools/GuiToolInstance.cs@@ -102,6 +102,11 @@ public sealed partial class GuiToolInstance : ObservableObject/// </summary>public void RebuildView(){+ if (_view is not null && _view.IsValueCreated)+ {+ _view.Value.CurrentOpenedDialog?.Dispose();+ }+_view= new(() =>{diff --git a/src/app/dev/platforms/desktop/DevToys.MacOS/MauiProgram.cs b/src/app/dev/platforms/desktop/DevToys.MacOS/MauiProgram.csindex 1b5f183e6..6a54a5a74 100644--- a/src/app/dev/platforms/desktop/DevToys.MacOS/MauiProgram.cs+++ b/src/app/dev/platforms/desktop/DevToys.MacOS/MauiProgram.cs@@ -108,6 +108,7 @@ public partial class MauiProgramserviceCollection.AddScoped<DocumentEventService, DocumentEventService>();serviceCollection.AddScoped<PopoverService, PopoverService>();serviceCollection.AddScoped<ContextMenuService, ContextMenuService>();+ serviceCollection.AddScoped<DialogService, DialogService>();serviceCollection.AddScoped<FontService, FontService>();ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();diff --git a/src/app/dev/platforms/desktop/DevToys.Windows/MainWindow.xaml.cs b/src/app/dev/platforms/desktop/DevToys.Windows/MainWindow.xaml.csindex 3aa52ba5a..0d1fea5e3 100644--- a/src/app/dev/platforms/desktop/DevToys.Windows/MainWindow.xaml.cs+++ b/src/app/dev/platforms/desktop/DevToys.Windows/MainWindow.xaml.cs@@ -155,6 +155,7 @@ public partial class MainWindow : MicaWindowWithOverlayserviceCollection.AddScoped<DocumentEventService, DocumentEventService>();serviceCollection.AddScoped<PopoverService, PopoverService>();serviceCollection.AddScoped<ContextMenuService, ContextMenuService>();+ serviceCollection.AddScoped<DialogService, DialogService>();serviceCollection.AddScoped<FontService, FontService>();ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();