添加项目文件。
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using WPFWCSDemo.Views;
|
||||
|
||||
namespace WPFWCSDemo.ViewModels.CustomComponent
|
||||
{
|
||||
public partial class MessageDialogViewModel:ObservableObject
|
||||
{
|
||||
public MessageDialogViewModel(Window window)
|
||||
{
|
||||
Caption = "消息";
|
||||
Content = "关闭该系统可能导致执行中的任务中断,是否确认要退出程序?";
|
||||
MessageDialog = window;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
string _caption;
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
string _content;
|
||||
/// <summary>
|
||||
/// 当前页面
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
Window _messageDialog;
|
||||
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
[RelayCommand]
|
||||
void Cancel(Window window)
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 终止程序
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
void Accept()
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
|
||||
public void GetMessageInfo(string content)
|
||||
{
|
||||
Caption = "消息";
|
||||
Content = content;
|
||||
}
|
||||
public void GetMessageInfo(string caption,string content)
|
||||
{
|
||||
Caption = caption;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user