Skip to content

A Swiss Army knife for developers.

Fixed some bugs

Etienne Baudoux26aad3f54f4f
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIButton.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIButton.cs
index 4252484bd..b3bca59b3 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIButton.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIButton.cs
@@ -173,6 +173,20 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when clicking on the button.
+ /// </summary>
+ public static IUIButton OnClick(this IUIButton element, Action? actionOnClick)
+ {
+ ((UIButton)element).OnClickAction
+ = () =>
+ {
+ actionOnClick?.Invoke();
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the button to appear as accented.
/// </summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIDataGrid.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIDataGrid.cs
index 7167637b3..844e602db 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIDataGrid.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIDataGrid.cs
@@ -162,6 +162,20 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when selecting an item in the data grid.
+ /// </summary>
+ public static IUIDataGrid OnRowSelected(this IUIDataGrid element, Action<IUIDataGridRow?>? onRowSelectedAction)
+ {
+ ((UIDataGrid)element).OnRowSelectedAction
+ = (value) =>
+ {
+ onRowSelectedAction?.Invoke(value);
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the <see cref="IUIDataGridRow"/> that should be selected in the data grid.
/// If <paramref name="row"/> is null or does not exist in the data grid, no row will be selected.
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIFileSelector.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIFileSelector.cs
index 916d1e313..307baba12 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIFileSelector.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIFileSelector.cs
@@ -117,6 +117,21 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when the user selected file(s).
+ /// </summary>
+ /// <remarks>The items contain a stream. It won't be disposed automatically. It is important to dispose the stream yourself, when not needed anymore</remarks>
+ public static IUIFileSelector OnFilesSelected(this IUIFileSelector element, Action<PickedFile[]>? actionOnFilesSelected)
+ {
+ ((UIFileSelector)element).OnFilesSelectedAction
+ = (value) =>
+ {
+ actionOnFilesSelected?.Invoke(value);
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the list of file extensions allowed to be selected. An empty list of file extensions indicates any kind of file.
/// </summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIInfoBar.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIInfoBar.cs
index e2682af38..dbeebdd3a 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIInfoBar.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIInfoBar.cs
@@ -288,6 +288,22 @@ public static partial class GUI
return infoBar;
}
+ /// <summary>
+ /// Sets the optional action button of the bar. The bar closes when the user click on the button.
+ /// </summary>
+ public static IUIInfoBar WithActionButton(this IUIInfoBar element, string text, bool isAccent, Action actionOnClick)
+ {
+ return WithActionButton(
+ element,
+ text,
+ isAccent,
+ () =>
+ {
+ actionOnClick?.Invoke();
+ return ValueTask.CompletedTask;
+ });
+ }
+
/// <summary>
/// Sets the action to run when the user clicks the action button.
/// </summary>
@@ -297,6 +313,20 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when the user clicks the action button.
+ /// </summary>
+ public static IUIInfoBar OnClose(this IUIInfoBar element, Action? actionOnClose)
+ {
+ ((UIInfoBar)element).OnCloseAction
+ = () =>
+ {
+ actionOnClose?.Invoke();
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the <see cref="IUIInfoBar.Severity"/> to <see cref="UIInfoBarSeverity.Informational"/>.
/// </summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIList.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIList.cs
index c86789ae2..e462e92d3 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIList.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUIList.cs
@@ -138,6 +138,20 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when selecting an item in the list.
+ /// </summary>
+ public static IUIList OnItemSelected(this IUIList element, Action<IUIListItem?>? onItemSelectedAction)
+ {
+ ((UIList)element).OnItemSelectedAction
+ = (item) =>
+ {
+ onItemSelectedAction?.Invoke(item);
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the <see cref="IUIList"/> that should be selected in the list.
/// If <paramref name="item"/> is null or does not exist in the list, no item will be selected.
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISelectDropDownList.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISelectDropDownList.cs
index 68b6c376f..d2a2b7c5d 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISelectDropDownList.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISelectDropDownList.cs
@@ -106,6 +106,20 @@ public static partial class GUI
return element;
}
+ /// <summary>
+ /// Sets the action to run when selecting an item in the drop down list.
+ /// </summary>
+ public static IUISelectDropDownList OnItemSelected(this IUISelectDropDownList element, Action<IUIDropDownListItem?>? onItemSelectedAction)
+ {
+ ((UISelectDropDownList)element).OnItemSelectedAction
+ = (item) =>
+ {
+ onItemSelectedAction?.Invoke(item);
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
+
/// <summary>
/// Sets the <see cref="IUIDropDownListItem"/> that should be selected in the drop down list.
/// If <paramref name="item"/> is null or does not exist in the list, no item will be selected.
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISetting.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISetting.cs
index 3c367e5fb..aa3051e37 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISetting.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISetting.cs
@@ -167,6 +167,33 @@ public static partial class GUI
onToggled);
}
+ /// <summary>
+ /// Sets a <see cref="IUISwitch"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
+ /// given <paramref name="settingDefinition"/> to the switch state.
+ /// </summary>
+ /// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
+ /// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISetting"/>.</param>
+ /// <param name="onToggled">(optional) A method to invoke when the setting value changed.</param>
+ public static IUISetting Handle(
+ this IUISetting element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<bool> settingDefinition,
+ Action<bool> onToggled)
+ {
+ return Handle(
+ element,
+ settingsProvider,
+ settingDefinition,
+ stateDescriptionWhenOn: null,
+ stateDescriptionWhenOff: null,
+ ignoreStateDescription: true,
+ (value) =>
+ {
+ onToggled?.Invoke(value);
+ return ValueTask.CompletedTask;
+ });
+ }
+
/// <summary>
/// Sets a <see cref="IUISwitch"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
/// given <paramref name="settingDefinition"/> to the switch state.
@@ -194,6 +221,64 @@ public static partial class GUI
onToggled);
}
+ /// <summary>
+ /// Sets a <see cref="IUISwitch"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
+ /// given <paramref name="settingDefinition"/> to the switch state.
+ /// </summary>
+ /// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
+ /// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISetting"/>.</param>
+ /// <param name="stateDescriptionWhenOn">The <see cref="IUISetting.StateDescription"/> to use when the option is On.</param>
+ /// <param name="stateDescriptionWhenOff">The <see cref="IUISetting.StateDescription"/> to use when the option is Off.</param>
+ /// <param name="onToggled">(optional) A method to invoke when the setting value changed.</param>
+ public static IUISetting Handle(
+ this IUISetting element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<bool> settingDefinition,
+ string? stateDescriptionWhenOn,
+ string? stateDescriptionWhenOff,
+ Action<bool>? onToggled)
+ {
+ return Handle(
+ element,
+ settingsProvider,
+ settingDefinition,
+ stateDescriptionWhenOn,
+ stateDescriptionWhenOff,
+ ignoreStateDescription: false,
+ (value) =>
+ {
+ onToggled?.Invoke(value);
+ return ValueTask.CompletedTask;
+ });
+ }
+
+ /// <summary>
+ /// Sets a <see cref="IUISelectDropDownList"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
+ /// given <paramref name="settingDefinition"/> to the switch state.
+ /// </summary>
+ /// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
+ /// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISetting"/>.</param>
+ /// <param name="onOptionSelected">(optional) A method to invoke when the setting value changed.</param>
+ /// <param name="dropDownListItems">(optional) A list of items to be displayed in the drop down list. <see cref="IUIDropDownListItem.Value"/> should be of type <typeparamref name="T"/>.</param>
+ public static IUISetting Handle<T>(
+ this IUISetting element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<T> settingDefinition,
+ Action<T>? onOptionSelected,
+ params IUIDropDownListItem[] dropDownListItems)
+ {
+ return Handle(
+ element,
+ settingsProvider,
+ settingDefinition,
+ (value) =>
+ {
+ onOptionSelected?.Invoke(value);
+ return ValueTask.CompletedTask;
+ },
+ dropDownListItems);
+ }
+
/// <summary>
/// Sets a <see cref="IUISelectDropDownList"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
/// given <paramref name="settingDefinition"/> to the switch state.
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISettingGroup.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISettingGroup.cs
index 1c0d1a68d..152c49b7b 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISettingGroup.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISettingGroup.cs
@@ -95,7 +95,11 @@ public static partial class GUI
/// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
/// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISettingGroup"/>.</param>
/// <param name="onToggled">(optional) A method to invoke when the setting value changed.</param>
- public static IUISettingGroup Handle(this IUISettingGroup element, ISettingsProvider settingsProvider, SettingDefinition<bool> settingDefinition, Func<bool, ValueTask>? onToggled = null)
+ public static IUISettingGroup Handle(
+ this IUISettingGroup element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<bool> settingDefinition,
+ Func<bool, ValueTask>? onToggled = null)
{
return (IUISettingGroup)((IUISetting)element).Handle(settingsProvider, settingDefinition, onToggled);
}
@@ -108,11 +112,60 @@ public static partial class GUI
/// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISetting"/>.</param>
/// <param name="onOptionSelected">(optional) A method to invoke when the setting value changed.</param>
/// <param name="dropDownListItems">(optional) A list of items to be displayed in the drop down list. <see cref="IUIDropDownListItem.Value"/> should be of type <typeparamref name="T"/>.</param>
- public static IUISettingGroup Handle<T>(this IUISettingGroup element, ISettingsProvider settingsProvider, SettingDefinition<T> settingDefinition, Func<T, ValueTask>? onOptionSelected, params IUIDropDownListItem[] dropDownListItems) where T : struct, IConvertible
+ public static IUISettingGroup Handle<T>(
+ this IUISettingGroup element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<T> settingDefinition,
+ Func<T, ValueTask>? onOptionSelected,
+ params IUIDropDownListItem[] dropDownListItems)
+ where T : struct, IConvertible
{
return (IUISettingGroup)((IUISetting)element).Handle(settingsProvider, settingDefinition, onOptionSelected, dropDownListItems);
}
+ /// <summary>
+ /// Sets a <see cref="IUISwitch"/> to <see cref="IUISettingGroup.InteractiveElement"/> and automatically associate the
+ /// given <paramref name="settingDefinition"/> to the switch state.
+ /// </summary>
+ /// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
+ /// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISettingGroup"/>.</param>
+ /// <param name="onToggled">(optional) A method to invoke when the setting value changed.</param>
+ public static IUISettingGroup Handle(
+ this IUISettingGroup element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<bool> settingDefinition,
+ Action<bool>? onToggled = null)
+ {
+ return (IUISettingGroup)((IUISetting)element).Handle(settingsProvider, settingDefinition, (value) =>
+ {
+ onToggled?.Invoke(value);
+ return ValueTask.CompletedTask;
+ });
+ }
+
+ /// <summary>
+ /// Sets a <see cref="IUISelectDropDownList"/> to <see cref="IUISetting.InteractiveElement"/> and automatically associate the
+ /// given <paramref name="settingDefinition"/> to the switch state.
+ /// </summary>
+ /// <param name="settingsProvider">The settings provider used for handling the given <paramref name="settingDefinition"/>.</param>
+ /// <param name="settingDefinition">The definition of the setting to associate to this <see cref="IUISetting"/>.</param>
+ /// <param name="onOptionSelected">(optional) A method to invoke when the setting value changed.</param>
+ /// <param name="dropDownListItems">(optional) A list of items to be displayed in the drop down list. <see cref="IUIDropDownListItem.Value"/> should be of type <typeparamref name="T"/>.</param>
+ public static IUISettingGroup Handle<T>(
+ this IUISettingGroup element,
+ ISettingsProvider settingsProvider,
+ SettingDefinition<T> settingDefinition,
+ Action<T>? onOptionSelected,
+ params IUIDropDownListItem[] dropDownListItems)
+ where T : struct, IConvertible
+ {
+ return (IUISettingGroup)((IUISetting)element).Handle(settingsProvider, settingDefinition, (value) =>
+ {
+ onOptionSelected?.Invoke(value);
+ return ValueTask.CompletedTask;
+ }, dropDownListItems);
+ }
+
/// <summary>
/// Sets the children to be displayed in the group.
/// </summary>
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISwitch.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISwitch.cs
index 80403b2a6..6cd162186 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISwitch.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/IUISwitch.cs
@@ -144,4 +144,18 @@ public static partial class GUI
((UISwitch)element).ActionOnToggle = actionOnToggle;
return element;
}
+
+ /// <summary>
+ /// Sets the action to run when toggling the switch.
+ /// </summary>
+ public static IUISwitch OnToggle(this IUISwitch element, Action<bool>? actionOnToggle)
+ {
+ ((UISwitch)element).ActionOnToggle
+ = (value) =>
+ {
+ actionOnToggle?.Invoke(value);
+ return ValueTask.CompletedTask;
+ };
+ return element;
+ }
}
diff --git a/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs
index c29137798..07ccd4352 100644
--- a/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs
+++ b/src/app/dev/DevToys.Api/Tool/GUI/Components/UIToolView.cs
@@ -100,11 +100,11 @@ public class UIToolView : INotifyPropertyChanged
/// <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(
+ public Task<UIDialog> OpenDialogAsync(
IUIElement dialogContent,
- bool isDismissible)
+ bool isDismissible = false)
{
- return OpenDialog(dialogContent, null, isDismissible);
+ return OpenDialogAsync(dialogContent, null, isDismissible);
}
/// <summary>
@@ -114,11 +114,13 @@ public class UIToolView : INotifyPropertyChanged
/// <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(
+ public async Task<UIDialog> OpenDialogAsync(
IUIElement dialogContent,
IUIElement? footerContent,
- bool isDismissible)
+ bool isDismissible = false)
{
+ await TaskSchedulerAwaiter.SwitchOffMainThreadAsync(CancellationToken.None);
+
if (CurrentOpenedDialog is not null)
{
ThrowHelper.ThrowInvalidOperationException("A dialog is already opened. Close it before opening another one.");
diff --git a/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs b/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs
index bacfd6b0a..4ace20e8d 100644
--- a/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs
+++ b/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs
@@ -77,12 +77,12 @@ internal sealed class SettingsGuiTool : IGuiTool
Button("help-translate-devtoys")
.HyperlinkAppearance()
.Text(Settings.HelpTranslating)
- .OnClick(OnHelpTranslatingButtonClickAsync),
+ .OnClick(OnHelpTranslatingButtonClick),
SelectDropDownList("language-select-drop-down-list")
.WithItems(_availableLanguages)
.Select(_currentLanguage)
- .OnItemSelected(OnLanguageSelectedAsync))),
+ .OnItemSelected(OnLanguageSelected))),
Setting("app-theme-setting")
.Icon("FluentSystemIcons", '\uF591')
@@ -114,7 +114,7 @@ internal sealed class SettingsGuiTool : IGuiTool
.Icon("FluentSystemIcons", '\uF4D5')
.Title(Settings.SmartDetection)
.Description(Settings.SmartDetectionDescription)
- .Handle(_settingsProvider, PredefinedSettings.SmartDetection, OnSmartDetectionOptionChangedAsync)
+ .Handle(_settingsProvider, PredefinedSettings.SmartDetection, OnSmartDetectionOptionChanged)
.WithSettings(
_smartDetectionAutomaticallyPasteSetting
@@ -138,7 +138,7 @@ internal sealed class SettingsGuiTool : IGuiTool
.Handle(
_settingsProvider,
PredefinedSettings.TextEditorFont,
- OnTextEditorFontChangedAsync,
+ OnTextEditorFontChanged,
dropDownListItems: _availableFonts),
Setting("text-editor-word-wrap-settings")
@@ -209,22 +209,20 @@ internal sealed class SettingsGuiTool : IGuiTool
{
}
- private ValueTask OnHelpTranslatingButtonClickAsync()
+ private void OnHelpTranslatingButtonClick()
{
Shell.OpenUrlInWebBrowser("https://crowdin.com/project/devtoys");
- return ValueTask.CompletedTask;
}
- private ValueTask OnLanguageSelectedAsync(IUIDropDownListItem? selectedItem)
+ private void OnLanguageSelected(IUIDropDownListItem? selectedItem)
{
if (selectedItem is not null && selectedItem.Value is LanguageDefinition languageDefinition)
{
_settingsProvider.SetSetting(PredefinedSettings.Language, languageDefinition.InternalName);
}
- return ValueTask.CompletedTask;
}
- private ValueTask OnSmartDetectionOptionChangedAsync(bool enabled)
+ private void OnSmartDetectionOptionChanged(bool enabled)
{
if (enabled)
{
@@ -234,20 +232,16 @@ internal sealed class SettingsGuiTool : IGuiTool
{
_smartDetectionAutomaticallyPasteSetting.Disable();
}
-
- return ValueTask.CompletedTask;
}
- private ValueTask OnCopyVersionNumberButtonClickAsync()
+ private async ValueTask OnCopyVersionNumberButtonClickAsync()
{
- _clipboard.SetClipboardTextAsync(GetAppVersionDescription());
- return ValueTask.CompletedTask;
+ await _clipboard.SetClipboardTextAsync(GetAppVersionDescription());
}
- private ValueTask OnTextEditorFontChangedAsync(string fontName)
+ private void OnTextEditorFontChanged(string fontName)
{
_textEditorFontSetting.StateDescription(fontName);
- return ValueTask.CompletedTask;
}
private IUIDropDownListItem[] LoadAvailableFonts()
diff --git a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor
index 71e5761f6..b87f6214c 100644
--- a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor
+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor
@@ -26,14 +26,14 @@
UIGridLength.Auto
})">
<GridCell Row="0">
- <ScrollViewer Orientation="UIOrientation.Vertical">
+ @* <ScrollViewer Orientation="UIOrientation.Vertical"> *@
<Container PaddingLeft="24"
PaddingRight="24"
PaddingTop="24"
PaddingBottom="24">
@Content
</Container>
- </ScrollViewer>
+ @* </ScrollViewer> *@
</GridCell>
<GridCell Row="1">
@if (Footer is not null)
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.scss
index aa988871a..d78b23654 100644
--- a/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.scss
+++ b/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor.scss
@@ -8,10 +8,10 @@
&-auto-height {
display: grid;
- min-height: 200px;
min-width: 300px;
- max-width: calc(100vh - 128px);
- max-height: calc(100vh - 64px);
+ min-height: 200px;
+ max-width: min(calc(100vw - 128px), 800px);
+ max-height: min(calc(100vh - 128px), 600px);
}
&-footer {
@@ -41,19 +41,18 @@
}
&-container {
+ z-index: calc(20000 + 10);
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;
+ margin: 0;
+ padding: 0;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
background: none;
pointer-events: none;
diff --git a/src/app/dev/DevToys.Blazor/Components/StyledComponentBase.cs b/src/app/dev/DevToys.Blazor/Components/StyledComponentBase.cs
index af428eede..8a2971a17 100644
--- a/src/app/dev/DevToys.Blazor/Components/StyledComponentBase.cs
+++ b/src/app/dev/DevToys.Blazor/Components/StyledComponentBase.cs
@@ -168,7 +168,10 @@ public abstract class StyledComponentBase : ComponentBase
/// <inheritdoc />
public new void StateHasChanged()
{
- base.StateHasChanged();
+ InvokeAsync(() =>
+ {
+ base.StateHasChanged();
+ });
}
private void CSS_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)