更新
This commit is contained in:
@@ -21,6 +21,52 @@ public class Student
|
||||
|
||||
public partial class BasicInputViewModel : ViewModel
|
||||
{
|
||||
[RelayCommand]
|
||||
private async Task OnOpenCustomMessageBox(object sender)
|
||||
{
|
||||
var uiMessageBox = new WPFluent.Controls.MessageWindow
|
||||
{
|
||||
Title = "消息框",
|
||||
Content =
|
||||
"永远不会放弃你,永远不会让你失望 永远不会跑来跑去抛弃你 永远不会让你哭泣,永远不会说再见",
|
||||
};
|
||||
|
||||
_ = await uiMessageBox.ShowDialogAsync();
|
||||
}
|
||||
[ObservableProperty]
|
||||
private bool _isFlyoutOpen = false;
|
||||
|
||||
[RelayCommand]
|
||||
private void FlyoutButtonClick(object sender)
|
||||
{
|
||||
if (!IsFlyoutOpen)
|
||||
{
|
||||
IsFlyoutOpen = true;
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private async void MsgAsync()
|
||||
{
|
||||
// Async methods
|
||||
_ = await WPFluent.Controls.MessageBox.InformationAsync("这是一条信息消息");
|
||||
_ = await WPFluent.Controls.MessageBox.WarningAsync("这是一个警告消息");
|
||||
_ = await WPFluent.Controls.MessageBox.ErrorAsync("这是一个错误消息");
|
||||
var result = await WPFluent.Controls.MessageBox.QuestionAsync("这是一个问题,请点击确定?");
|
||||
}
|
||||
[RelayCommand]
|
||||
private void MsgSync()
|
||||
{
|
||||
_ = WPFluent.Controls.MessageBox.Information("这是一条信息消息");
|
||||
_ = WPFluent.Controls.MessageBox.Warning("这是一个警告消息");
|
||||
_ = WPFluent.Controls.MessageBox.Error("这是一个错误消息");
|
||||
var result = WPFluent.Controls.MessageBox.Question("这是一个问题,请点击确定?");
|
||||
}
|
||||
[RelayCommand]
|
||||
private void MsgPending()
|
||||
{
|
||||
using IPendingHandler pending = PendingBox.Show("做些事情", "标题", isShowCancel: true);
|
||||
|
||||
}
|
||||
public BasicInputViewModel()
|
||||
{
|
||||
GenerateTreeViewItem();
|
||||
@@ -38,13 +84,33 @@ public partial class BasicInputViewModel : ViewModel
|
||||
})
|
||||
);
|
||||
[RelayCommand]
|
||||
private void ButtonClick()
|
||||
private void ButtonClick(object sender)
|
||||
{
|
||||
Toast.Information("I am information message");
|
||||
Toast.Error("I am error message");
|
||||
Toast.Success("I am success message");
|
||||
Toast.Warning("I am warning message");
|
||||
Toast.Show(owner: null!, "I am any message", new ToastConfig());
|
||||
if (sender is WPFluent.Controls.Button button)
|
||||
{
|
||||
switch (button.Appearance)
|
||||
{
|
||||
case ControlAppearance.Primary:
|
||||
break;
|
||||
case ControlAppearance.Accent:
|
||||
break;
|
||||
case ControlAppearance.Attention:
|
||||
Toast.Information("I am information message");
|
||||
break;
|
||||
case ControlAppearance.Success:
|
||||
Toast.Success("I am success message");
|
||||
break;
|
||||
case ControlAppearance.Caution:
|
||||
Toast.Warning("I am warning message");
|
||||
break;
|
||||
case ControlAppearance.Critical:
|
||||
Toast.Error("I am error message");
|
||||
break;
|
||||
case ControlAppearance.Transparent:
|
||||
Toast.Show(owner: null!, "I am any message", new ToastConfig());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public ObservableCollection<Grade> Grades { get; set; } = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user