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.Text;
using System.Threading.Tasks;
using Validar;

namespace LogoForceTestApp.Modules.MainModule.ViewModels
{
    [InjectValidation] //验证表单
    internal class ChartPage2ViewModel : BindableBase, IDialogAware
    {
        public string Title => "chart2";

        public event Action<IDialogResult> RequestClose;

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {

        }

        public void OnDialogOpened(IDialogParameters parameters)
        {

        }
        public string C1 { get; set; }
        public string C2 { get; set; }
        public string C3 { get; set; }
        public string C4 { get; set; }
        public string C5 { get; set; }


        public DelegateCommand CloseCmd { get; set; }
        public ChartPage2ViewModel()
        {
            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);
            }
        }


    }

}