12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
-
- ///////////////////////////////////////////////////////////////////////////////
- //文件名称: WinInsurancePolicyEditor.xaml
- //文件描述: 保险单编辑
- //创 建 者: xls
- //创建日期: 2018/5/24 22:01:48
- //版 本 号:1.0.0.0
- ////////////////////////////////////////////////////////////////////////////////
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using Com.FirmLib.UI.Insuer.Model;
- using FWindSoft.Wpf;
- using FWindSoft.Wpf.Controls;
- namespace Com.FirmLib.UI.Insuer
- {
- /// <summary>
- /// WinInsurancePolicyEditor.xaml 的交互逻辑
- /// </summary>
- public partial class WinInsurancePolicyEditor : NChildWindow
- {
- private VmInsurancePolicyEditor m_Vm;
- public WinInsurancePolicyEditor():this(new VmInsurancePolicyEditor())
- {
-
- }
- public WinInsurancePolicyEditor(VmInsurancePolicyEditor vm)
- {
- InitializeComponent();
- this.m_Vm = vm;
- this.m_Vm.SetRefView(this);
- this.DataContext = this.m_Vm;
- this.m_Vm.WatchValidateResult(() => !this.HasError());
- }
- protected override void LoadData(LoadParameter parameter)
- {
- InsuerParameter currentParameter = parameter.Parameter as InsuerParameter;
- if (string.IsNullOrWhiteSpace(currentParameter.Project.Id))
- {
- this.Title = "增加保单";
- }
- else
- {
- this.Title = "修改保单";
- }
- TryCatchWrapper.Handled(() => this.m_Vm.Init(parameter));
- }
- #region 界面关联事件
- private void btnOK_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- try
- {
- this.m_Vm.BeginInEdit();
- var textBoxes = this.GetSpecifyTypeChildren<TextBox>();
- foreach (var textBox in textBoxes)
- {
- var binding = textBox.GetBindingExpression(TextBox.TextProperty);
- if (binding != null)
- {
- binding.UpdateSource();
- }
- }
- }
- finally
- {
- this.m_Vm.EndInEdit();
- }
- if (this.HasError())
- {
- //MessageShow.Infomation("请修改错误输入项");
- return;
- }
- }
- catch (Exception ex)
- {
- //MessageShow.Show(ex);
- }
- }
- private void btnCancel_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
- #endregion
- }
- }
|