Add Icon for dialogwindow
Add ShowInTaskBar for DialogOptions
This commit is contained in:
@@ -34,6 +34,12 @@
|
||||
IsVisible="{Binding !#overlay.IsChecked}"
|
||||
OffContent="Regular"
|
||||
OnContent="Modal" />
|
||||
<ToggleSwitch
|
||||
Content="HideInTaskBar/ShowInTaskBar"
|
||||
IsChecked="{Binding ShowInTaskBar}"
|
||||
IsVisible="{Binding #overlay.IsChecked}"
|
||||
OffContent="HideInTaskBar"
|
||||
OnContent="ShowInTaskBar" />
|
||||
<ToggleSwitch
|
||||
Content="ClickOnMaskToClose"
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
@@ -77,6 +83,12 @@
|
||||
IsVisible="{Binding !#overlay2.IsChecked}"
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Content="HideInTaskBar/ShowInTaskBar"
|
||||
IsChecked="{Binding ShowInTaskBar}"
|
||||
IsVisible="{Binding #overlay2.IsChecked}"
|
||||
OffContent="HideInTaskBar"
|
||||
OnContent="ShowInTaskBar" />
|
||||
<ToggleSwitch
|
||||
Name="modal"
|
||||
Content="Modal/Regular"
|
||||
|
||||
@@ -26,6 +26,7 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
[ObservableProperty] private bool _result;
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
[ObservableProperty] private bool _fullScreen;
|
||||
[ObservableProperty] private bool _showInTaskBar;
|
||||
|
||||
public DialogDemoViewModel()
|
||||
{
|
||||
@@ -33,6 +34,7 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
ShowCustomDialogCommand = new AsyncRelayCommand(ShowCustomDialog);
|
||||
IsModal = true;
|
||||
IsGlobal = true;
|
||||
ShowInTaskBar = false;
|
||||
}
|
||||
|
||||
private async Task ShowDialog()
|
||||
@@ -45,7 +47,8 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
{
|
||||
Title = "Please select a date",
|
||||
Mode = SelectedMode,
|
||||
Button = SelectedButton
|
||||
Button = SelectedButton,
|
||||
ShowInTaskBar = ShowInTaskBar,
|
||||
});
|
||||
Date = vm.Date;
|
||||
}
|
||||
@@ -97,13 +100,21 @@ public partial class DialogDemoViewModel: ObservableObject
|
||||
if (IsModal)
|
||||
{
|
||||
Result = await Dialog.ShowCustomModal<DialogWithAction, DialogWithActionViewModel, bool>(
|
||||
vm);
|
||||
vm,
|
||||
options: new DialogOptions
|
||||
{
|
||||
ShowInTaskBar = ShowInTaskBar
|
||||
});
|
||||
Date = vm.Date;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(
|
||||
vm);
|
||||
vm,
|
||||
options: new DialogOptions
|
||||
{
|
||||
ShowInTaskBar = ShowInTaskBar
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Media;
|
||||
using Ursa.Common;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -34,6 +31,7 @@ public static class Dialog
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Icon = owner.Icon;
|
||||
window.Show(owner);
|
||||
}
|
||||
}
|
||||
@@ -60,6 +58,7 @@ public static class Dialog
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Icon = owner.Icon;
|
||||
window.Show(owner);
|
||||
}
|
||||
}
|
||||
@@ -84,11 +83,16 @@ public static class Dialog
|
||||
};
|
||||
ConfigureDefaultDialogWindow(window, options);
|
||||
owner ??= GetMainWindow();
|
||||
window.Icon = owner!.Icon;
|
||||
if (owner is null)
|
||||
{
|
||||
window.Show();
|
||||
return Task.FromResult(DialogResult.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Icon = owner.Icon;
|
||||
}
|
||||
return window.ShowDialog<DialogResult>(owner);
|
||||
}
|
||||
|
||||
@@ -114,6 +118,10 @@ public static class Dialog
|
||||
window.Show();
|
||||
return Task.FromResult(DialogResult.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Icon = owner.Icon;
|
||||
}
|
||||
return window.ShowDialog<DialogResult>(owner);
|
||||
}
|
||||
|
||||
@@ -143,6 +151,10 @@ public static class Dialog
|
||||
window.Show();
|
||||
return Task.FromResult(default(TResult));
|
||||
}
|
||||
else
|
||||
{
|
||||
window.Icon = owner.Icon;
|
||||
}
|
||||
return window.ShowDialog<TResult?>(owner);
|
||||
}
|
||||
|
||||
@@ -170,6 +182,11 @@ public static class Dialog
|
||||
window.Show();
|
||||
return Task.FromResult(default(TResult));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
window.Icon = owner.Icon;
|
||||
}
|
||||
return window.ShowDialog<TResult?>(owner);
|
||||
}
|
||||
|
||||
@@ -197,6 +214,7 @@ public static class Dialog
|
||||
window.WindowStartupLocation = options.StartupLocation;
|
||||
window.Title = options.Title;
|
||||
window.IsCloseButtonVisible = options.IsCloseButtonVisible;
|
||||
window.ShowInTaskbar = options.ShowInTaskBar;
|
||||
if (options.StartupLocation == WindowStartupLocation.Manual)
|
||||
{
|
||||
if (options.Position is not null)
|
||||
@@ -222,6 +240,7 @@ public static class Dialog
|
||||
window.Title = options.Title;
|
||||
window.Buttons = options.Button;
|
||||
window.Mode = options.Mode;
|
||||
window.ShowInTaskbar = options.ShowInTaskBar;
|
||||
if (options.StartupLocation == WindowStartupLocation.Manual)
|
||||
{
|
||||
if (options.Position is not null)
|
||||
|
||||
@@ -26,4 +26,6 @@ public class DialogOptions
|
||||
public DialogButton Button { get; set; } = DialogButton.OKCancel;
|
||||
|
||||
public bool IsCloseButtonVisible { get; set; } = true;
|
||||
|
||||
public bool ShowInTaskBar { get; set; } = true;
|
||||
}
|
||||
Reference in New Issue
Block a user