整理控件库
This commit is contained in:
@@ -47,53 +47,6 @@ public partial class DialogsAndFlyoutsViewModel : ViewModel
|
||||
|
||||
_ = await uiMessageBox.ShowDialogAsync();
|
||||
}
|
||||
#region Snackbar
|
||||
private ControlAppearance _snackbarAppearance = ControlAppearance.Secondary;
|
||||
|
||||
[ObservableProperty]
|
||||
private int _snackbarTimeout = 2;
|
||||
|
||||
private int _snackbarAppearanceComboBoxSelectedIndex = 1;
|
||||
|
||||
public int SnackbarAppearanceComboBoxSelectedIndex
|
||||
{
|
||||
get => _snackbarAppearanceComboBoxSelectedIndex;
|
||||
set
|
||||
{
|
||||
_ = SetProperty(ref _snackbarAppearanceComboBoxSelectedIndex, value);
|
||||
UpdateSnackbarAppearance(value);
|
||||
}
|
||||
}
|
||||
|
||||
ISnackbarService snackbarService;
|
||||
[RelayCommand]
|
||||
private void OnOpenSnackbar(object sender)
|
||||
{
|
||||
snackbarService.Show(
|
||||
"Don't Blame Yourself.",
|
||||
"No Witcher's Ever Died In His Bed.",
|
||||
_snackbarAppearance,
|
||||
new SymbolIcon(SymbolRegular.Fluent24),
|
||||
TimeSpan.FromSeconds(SnackbarTimeout)
|
||||
);
|
||||
}
|
||||
|
||||
private void UpdateSnackbarAppearance(int appearanceIndex)
|
||||
{
|
||||
_snackbarAppearance = appearanceIndex switch
|
||||
{
|
||||
1 => ControlAppearance.Secondary,
|
||||
2 => ControlAppearance.Info,
|
||||
3 => ControlAppearance.Success,
|
||||
4 => ControlAppearance.Caution,
|
||||
5 => ControlAppearance.Danger,
|
||||
6 => ControlAppearance.Light,
|
||||
7 => ControlAppearance.Dark,
|
||||
8 => ControlAppearance.Transparent,
|
||||
_ => ControlAppearance.Primary,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
[ObservableProperty]
|
||||
private bool _isFlyoutOpen = false;
|
||||
|
||||
@@ -106,7 +59,7 @@ public partial class DialogsAndFlyoutsViewModel : ViewModel
|
||||
}
|
||||
}
|
||||
#region ContentDialog
|
||||
IContentDialogService contentDialogService;
|
||||
ContentDialogService contentDialogService;
|
||||
[ObservableProperty]
|
||||
private string _dialogResultText = string.Empty;
|
||||
|
||||
@@ -114,7 +67,7 @@ public partial class DialogsAndFlyoutsViewModel : ViewModel
|
||||
private async Task OnShowDialog(object content)
|
||||
{
|
||||
ContentDialogResult result = await contentDialogService.ShowSimpleDialogAsync(
|
||||
new SimpleContentDialogCreateOptions()
|
||||
new SimpleContentDialogOptions()
|
||||
{
|
||||
Title = "Save your work?",
|
||||
Content = content,
|
||||
|
||||
Reference in New Issue
Block a user