将Catch块中 打印Log的全部替换为NotificationHelper.ShowError
This commit is contained in:
30
Views/Dialogs/MqttSelectionDialog.xaml.cs
Normal file
30
Views/Dialogs/MqttSelectionDialog.xaml.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using PMSWPF.Models;
|
||||
using PMSWPF.ViewModels.Dialogs;
|
||||
|
||||
namespace PMSWPF.Views.Dialogs;
|
||||
|
||||
public partial class MqttSelectionDialog : ContentDialog
|
||||
{
|
||||
public MqttSelectionDialog(MqttSelectionDialogViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
// 在这里可以添加一些验证逻辑,例如确保选择了MQTT服务器
|
||||
var viewModel = (MqttSelectionDialogViewModel)DataContext;
|
||||
if (viewModel.SelectedMqtt == null)
|
||||
{
|
||||
args.Cancel = true; // 取消关闭对话框
|
||||
// 可以显示一个警告消息
|
||||
}
|
||||
}
|
||||
|
||||
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
// 用户点击取消,不需要额外处理
|
||||
}
|
||||
}
|
||||
14
Views/Dialogs/PollLevelDialog.xaml.cs
Normal file
14
Views/Dialogs/PollLevelDialog.xaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using PMSWPF.ViewModels.Dialogs;
|
||||
|
||||
namespace PMSWPF.Views.Dialogs
|
||||
{
|
||||
public partial class PollLevelDialog : ContentDialog
|
||||
{
|
||||
public PollLevelDialog(PollLevelDialogViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user