2025-06-25 22:33:57 +08:00
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
|
|
|
|
using HandyControl.Tools.Extension;
|
|
|
|
|
|
using iNKORE.UI.WPF.Modern.Controls;
|
|
|
|
|
|
using PMSWPF.Message;
|
2025-06-12 18:56:25 +08:00
|
|
|
|
using PMSWPF.Models;
|
2025-06-12 13:15:55 +08:00
|
|
|
|
using PMSWPF.ViewModels.Dialogs;
|
|
|
|
|
|
using PMSWPF.Views.Dialogs;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PMSWPF.Services;
|
|
|
|
|
|
|
2025-06-26 19:36:27 +08:00
|
|
|
|
public class DialogService :IDialogService
|
2025-06-12 13:15:55 +08:00
|
|
|
|
{
|
2025-06-25 22:33:57 +08:00
|
|
|
|
public DialogService()
|
|
|
|
|
|
{
|
2025-06-26 19:36:27 +08:00
|
|
|
|
|
2025-06-25 22:33:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-12 18:56:25 +08:00
|
|
|
|
public async Task<Device> ShowAddDeviceDialog()
|
2025-06-12 13:15:55 +08:00
|
|
|
|
{
|
2025-06-23 17:01:06 +08:00
|
|
|
|
var device = new Device();
|
2025-06-26 19:36:27 +08:00
|
|
|
|
var dialog = new DeviceDialog(device);
|
2025-06-23 17:01:06 +08:00
|
|
|
|
var res = await dialog.ShowAsync();
|
2025-06-26 19:36:27 +08:00
|
|
|
|
if (res == ContentDialogResult.Primary)
|
|
|
|
|
|
{
|
|
|
|
|
|
return device;
|
|
|
|
|
|
}
|
2025-06-23 17:01:06 +08:00
|
|
|
|
return null;
|
2025-06-12 13:15:55 +08:00
|
|
|
|
}
|
2025-06-13 18:54:17 +08:00
|
|
|
|
|
|
|
|
|
|
public void ShowMessageDialog(string title, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(message);
|
|
|
|
|
|
}
|
2025-06-25 22:33:57 +08:00
|
|
|
|
|
2025-06-12 13:15:55 +08:00
|
|
|
|
}
|