73 lines
1.6 KiB
C#
73 lines
1.6 KiB
C#
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;
|
|
|
|
namespace WPFWCSDemo.ViewModels.CustomComponent
|
|
{
|
|
public partial class InputDialogViewModel : ObservableObject
|
|
{
|
|
|
|
public InputDialogViewModel(Window window,Action<string> action)
|
|
{
|
|
Caption = "验证";
|
|
InputDialog = window;
|
|
_task = action;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 标题
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
string _caption;
|
|
/// <summary>
|
|
/// 内容
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
string _content;
|
|
/// <summary>
|
|
/// 当前页面
|
|
/// </summary>
|
|
[ObservableProperty]
|
|
Window _inputDialog;
|
|
|
|
[ObservableProperty]
|
|
Action<string>? _task;
|
|
|
|
/// <summary>
|
|
/// 关闭窗口
|
|
/// </summary>
|
|
/// <param name="window"></param>
|
|
[RelayCommand]
|
|
void Cancel(Window window)
|
|
{
|
|
window.Close();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 输入密码
|
|
/// </summary>
|
|
[RelayCommand]
|
|
void Accept(string taskId)
|
|
{
|
|
if (Content == "472")
|
|
{
|
|
MessageBox.Show("密码正确");
|
|
//Task.Invoke(taskId);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|