Files

88 lines
1.8 KiB
C#

using WxOrder.Framework.Commons;
using WxOrder.Framework.Commons;
using _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPFCommon.Models;
using WxOrder.Framework.Commons.Dialogs;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace _29WxOrderWpf.Ctrls.PDDInvoice;
/// <summary>
/// PDDInvoiceDialog.xaml 的交互逻辑
/// </summary>
public partial class PDDInvoiceDialog : UserControl, IDialogAware
{
public PDDInvoiceDialog(InvoiceConfig config)
{
InitializeComponent();
DataContext = this;
Config = new InvoiceConfig();
Config.Assign(config);
}
public string Title { get; set; }
public event Action<IDialogResult> RequestClose;
private void PDDInvoiceDialog_Loaded(object sender, RoutedEventArgs e)
{
}
public void OnDialogOpened(IDialogParameters parameters)
{
Title = "设置";
}
private void ViewModel_RequestClose()
{
Window parentWindow = Window.GetWindow(this);
if (this.IsLoaded && parentWindow != null)
parentWindow.Close();
}
public InvoiceConfig Config { get; }
public ICommand ConfirmCommand => new DelegateCommand(Confirm);
private void Confirm()
{
RequestClose?.Invoke(new DialogResult(ButtonResult.OK, new DialogParameters
{
{ "config",Config}
}));
}
public ICommand CancelCommand => new DelegateCommand(Cancel);
private void Cancel()
{
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
}
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
}