1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using Validar;
- using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
- namespace LogoForceTestApp.Modules.MainModule.ViewModels
- {
- [InjectValidation] //验证表单
- internal class ChartPage1ViewModel : BindableBase, IDialogAware
- {
- public string Title => "chart1";
- public event Action<IDialogResult> RequestClose;
- [Required]
- public string C1 { get; set; }
- public string C2 { get; set; }
- public string C3 { get; set; }
- //[Required] //必须写 // [Range(minimum: 1, maximum: int.MaxValue)] //范围
- public string C4 { get; set; }
- public string C5 { get; set; }
-
- public DelegateCommand CloseCmd { get; set; }
- public ChartPage1ViewModel()
- {
- CloseCmd = new DelegateCommand(Close);
- }
- private void Close()
- {
- if (C1 == null && C2 == null && C3 == null && C4 == null && C5 == null)
- {
- return;
- }
- else
- {
- var dialog = new DialogResult();
- dialog.Parameters.Add("c1", C1);
- dialog.Parameters.Add("c2", C2);
- dialog.Parameters.Add("c3", C3);
- dialog.Parameters.Add("c4", C4);
- dialog.Parameters.Add("c5", C5);
- RequestClose?.Invoke(dialog);
- }
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
-
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
-
- }
-
- }
-
- }
|