Merge pull request #262 from NeverMorewd/main
Add Icon&ShowInTaskBar for DialogWindow
This commit is contained in:
@@ -22,7 +22,6 @@ public class PlainDialogViewModel: ObservableObject
|
|||||||
|
|
||||||
public PlainDialogViewModel()
|
public PlainDialogViewModel()
|
||||||
{
|
{
|
||||||
Text =
|
Text = "I am PlainDialogViewModel!";
|
||||||
"千古悠悠 有多少冤魂嗟叹 空怅望人寰无限 丛生哀怨 泣血蝇虫笑苍天 孤帆叠影锁白链 残月升骤起烈烈风 尽吹散 尽吹散 尽吹散 滂沱雨无底涧 涉激流登彼岸 奋力拨云间消得雾患 社稷安抚臣子心 长驱鬼魅不休战 看斜阳照大地阡陌 从头转";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,12 @@
|
|||||||
OffContent="Regular"
|
OffContent="Regular"
|
||||||
OnContent="Modal" />
|
OnContent="Modal" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
|
Content="HideInTaskBar/ShowInTaskBar"
|
||||||
|
IsChecked="{Binding ShowInTaskBar}"
|
||||||
|
IsVisible="{Binding #overlay.IsChecked}"
|
||||||
|
OffContent="HideInTaskBar"
|
||||||
|
OnContent="ShowInTaskBar" />
|
||||||
|
<ToggleSwitch
|
||||||
Content="ClickOnMaskToClose"
|
Content="ClickOnMaskToClose"
|
||||||
IsChecked="{Binding CanLightDismiss}"
|
IsChecked="{Binding CanLightDismiss}"
|
||||||
OffContent="No"
|
OffContent="No"
|
||||||
@@ -78,6 +84,12 @@
|
|||||||
OffContent="Local"
|
OffContent="Local"
|
||||||
OnContent="Global" />
|
OnContent="Global" />
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
|
Content="HideInTaskBar/ShowInTaskBar"
|
||||||
|
IsChecked="{Binding ShowInTaskBar}"
|
||||||
|
IsVisible="{Binding #overlay2.IsChecked}"
|
||||||
|
OffContent="HideInTaskBar"
|
||||||
|
OnContent="ShowInTaskBar" />
|
||||||
|
<ToggleSwitch
|
||||||
Name="modal"
|
Name="modal"
|
||||||
Content="Modal/Regular"
|
Content="Modal/Regular"
|
||||||
IsChecked="{Binding IsModal}"
|
IsChecked="{Binding IsModal}"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public partial class DialogDemoViewModel: ObservableObject
|
|||||||
[ObservableProperty] private bool _result;
|
[ObservableProperty] private bool _result;
|
||||||
[ObservableProperty] private DateTime? _date;
|
[ObservableProperty] private DateTime? _date;
|
||||||
[ObservableProperty] private bool _fullScreen;
|
[ObservableProperty] private bool _fullScreen;
|
||||||
|
[ObservableProperty] private bool _showInTaskBar;
|
||||||
|
|
||||||
public DialogDemoViewModel()
|
public DialogDemoViewModel()
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,7 @@ public partial class DialogDemoViewModel: ObservableObject
|
|||||||
ShowCustomDialogCommand = new AsyncRelayCommand(ShowCustomDialog);
|
ShowCustomDialogCommand = new AsyncRelayCommand(ShowCustomDialog);
|
||||||
IsModal = true;
|
IsModal = true;
|
||||||
IsGlobal = true;
|
IsGlobal = true;
|
||||||
|
ShowInTaskBar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ShowDialog()
|
private async Task ShowDialog()
|
||||||
@@ -45,7 +47,8 @@ public partial class DialogDemoViewModel: ObservableObject
|
|||||||
{
|
{
|
||||||
Title = "Please select a date",
|
Title = "Please select a date",
|
||||||
Mode = SelectedMode,
|
Mode = SelectedMode,
|
||||||
Button = SelectedButton
|
Button = SelectedButton,
|
||||||
|
ShowInTaskBar = ShowInTaskBar,
|
||||||
});
|
});
|
||||||
Date = vm.Date;
|
Date = vm.Date;
|
||||||
}
|
}
|
||||||
@@ -97,13 +100,21 @@ public partial class DialogDemoViewModel: ObservableObject
|
|||||||
if (IsModal)
|
if (IsModal)
|
||||||
{
|
{
|
||||||
Result = await Dialog.ShowCustomModal<DialogWithAction, DialogWithActionViewModel, bool>(
|
Result = await Dialog.ShowCustomModal<DialogWithAction, DialogWithActionViewModel, bool>(
|
||||||
vm);
|
vm,
|
||||||
|
options: new DialogOptions
|
||||||
|
{
|
||||||
|
ShowInTaskBar = ShowInTaskBar
|
||||||
|
});
|
||||||
Date = vm.Date;
|
Date = vm.Date;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(
|
Dialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(
|
||||||
vm);
|
vm,
|
||||||
|
options: new DialogOptions
|
||||||
|
{
|
||||||
|
ShowInTaskBar = ShowInTaskBar
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Controls.Shapes;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Ursa.Common;
|
|
||||||
|
|
||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
|
|
||||||
@@ -34,6 +31,7 @@ public static class Dialog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
window.Icon = owner.Icon;
|
||||||
window.Show(owner);
|
window.Show(owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,6 +58,7 @@ public static class Dialog
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
window.Icon = owner.Icon;
|
||||||
window.Show(owner);
|
window.Show(owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,6 +88,10 @@ public static class Dialog
|
|||||||
window.Show();
|
window.Show();
|
||||||
return Task.FromResult(DialogResult.None);
|
return Task.FromResult(DialogResult.None);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Icon = owner.Icon;
|
||||||
|
}
|
||||||
return window.ShowDialog<DialogResult>(owner);
|
return window.ShowDialog<DialogResult>(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +117,10 @@ public static class Dialog
|
|||||||
window.Show();
|
window.Show();
|
||||||
return Task.FromResult(DialogResult.None);
|
return Task.FromResult(DialogResult.None);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Icon = owner.Icon;
|
||||||
|
}
|
||||||
return window.ShowDialog<DialogResult>(owner);
|
return window.ShowDialog<DialogResult>(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +150,10 @@ public static class Dialog
|
|||||||
window.Show();
|
window.Show();
|
||||||
return Task.FromResult(default(TResult));
|
return Task.FromResult(default(TResult));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window.Icon = owner.Icon;
|
||||||
|
}
|
||||||
return window.ShowDialog<TResult?>(owner);
|
return window.ShowDialog<TResult?>(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +181,11 @@ public static class Dialog
|
|||||||
window.Show();
|
window.Show();
|
||||||
return Task.FromResult(default(TResult));
|
return Task.FromResult(default(TResult));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
window.Icon = owner.Icon;
|
||||||
|
}
|
||||||
return window.ShowDialog<TResult?>(owner);
|
return window.ShowDialog<TResult?>(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +213,7 @@ public static class Dialog
|
|||||||
window.WindowStartupLocation = options.StartupLocation;
|
window.WindowStartupLocation = options.StartupLocation;
|
||||||
window.Title = options.Title;
|
window.Title = options.Title;
|
||||||
window.IsCloseButtonVisible = options.IsCloseButtonVisible;
|
window.IsCloseButtonVisible = options.IsCloseButtonVisible;
|
||||||
|
window.ShowInTaskbar = options.ShowInTaskBar;
|
||||||
if (options.StartupLocation == WindowStartupLocation.Manual)
|
if (options.StartupLocation == WindowStartupLocation.Manual)
|
||||||
{
|
{
|
||||||
if (options.Position is not null)
|
if (options.Position is not null)
|
||||||
@@ -222,6 +239,7 @@ public static class Dialog
|
|||||||
window.Title = options.Title;
|
window.Title = options.Title;
|
||||||
window.Buttons = options.Button;
|
window.Buttons = options.Button;
|
||||||
window.Mode = options.Mode;
|
window.Mode = options.Mode;
|
||||||
|
window.ShowInTaskbar = options.ShowInTaskBar;
|
||||||
if (options.StartupLocation == WindowStartupLocation.Manual)
|
if (options.StartupLocation == WindowStartupLocation.Manual)
|
||||||
{
|
{
|
||||||
if (options.Position is not null)
|
if (options.Position is not null)
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ public class DialogOptions
|
|||||||
public DialogButton Button { get; set; } = DialogButton.OKCancel;
|
public DialogButton Button { get; set; } = DialogButton.OKCancel;
|
||||||
|
|
||||||
public bool IsCloseButtonVisible { get; set; } = true;
|
public bool IsCloseButtonVisible { get; set; } = true;
|
||||||
|
|
||||||
|
public bool ShowInTaskBar { get; set; } = true;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user