123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
-
- ///////////////////////////////////////////////////////////////////////////////
- //文件名称: WinSeller.xaml
- //文件描述: 供应商信息
- //创 建 者: xls
- //创建日期: 2018/5/24 21:14:59
- //版 本 号:1.0.0.0
- ////////////////////////////////////////////////////////////////////////////////
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using Com.FirmLib.UI.BllCommon;
- using Com.FirmLib.UI.Common;
- using FWindSoft.Data;
- using FWindSoft.Wpf;
- using FWindSoft.Wpf.Controls;
- namespace Com.FirmLib.UI.Seller
- {
- /// <summary>
- /// WinSeller.xaml 的交互逻辑
- /// </summary>
- public partial class WinSellerInfo : NChildWindow
- {
- private VmSellerInfo m_Vm;
- public WinSellerInfo():this(new VmSellerInfo())
- {
-
- }
- public WinSellerInfo(VmSellerInfo vm)
- {
- InitializeComponent();
- EveryTimeLoad = true;
- this.m_Vm = vm;
- this.m_Vm.SetRefView(this);
- this.DataContext = this.m_Vm;
- this.CommandBindings.Add(new CommandBinding(EditCommands.SingleUpdate, SingleUpdate));
- }
- protected override void LoadData(LoadParameter parameter)
- {
- //初始化列表数据
- TryCatchWrapper.Handled(() => this.m_Vm.Init(parameter));
- this.Title = this.m_Vm.Name;
- }
- #region 界面关联事件
- private void btnOK_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- if (this.HasError())
- {
- //MessageShow.Infomation("请修改错误输入项");
- return;
- }
- //if (Execute())
- //{
- // MessageShow.Infomation("");
- // DialogResult = true;
- //}
- }
- catch (Exception ex)
- {
- //MessageShow.Show(ex);
- }
- }
- private void btnCancel_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
- #endregion
- #region 命令绑定相关
- void SingleUpdate(object sender, ExecutedRoutedEventArgs e)
- {
- TextBoxEditor editor = e.Parameter as TextBoxEditor;
- if (editor == null)
- return;
- string field = string.Empty;
- if (editor.Tag != null)
- {
- field = editor.Tag.ToString();
- }
- bool result = this.m_Vm.SingleUpdateVenderItem(field);
- if (!result)
- {
- //editor.Focus();
- editor.IsEditing = true;
- }
- }
- #endregion
- #region 动态更新列
- private void ListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
- {
- var list = sender as ListBox;
- if (list == null)
- {
- return;
- }
-
- var current = (list.SelectedItem as TreeNavigationItem<BasePropertyChanged>)?.RefItem as ShowDataItem;
- if (current == null)
- {
- return;
- }
-
- CreateColumns(current.FamilyCode);
- }
- public void CreateColumns(string code)
- {
- if (string.IsNullOrEmpty(code))
- {
- return;
- }
- for (int i = ProductTypeGrid.Columns.Count - 1; i >1; i--)
- {
- ProductTypeGrid.Columns.RemoveAt(i);
- }
- var definitions = ProductTypeManager.GetInfoPointDefinitions(code);
- definitions.ForEach(c => c.IsReadOnly = false);
- var columns = ProductTypeGrid.CreateColumns(definitions, "RefItem.Parameters", InfoPointTemplateParse.CreateTemplateManager());
- columns.ForEach(c =>
- {
- //DataGridDragCopyOptions.SetCanColumnDragCopy(c, true);
- c.Width = c.Header.ToString().Length * 16+40;
- c.IsReadOnly = true;
- c.MinWidth = 80;
- });
- }
- #endregion
-
- }
- }
|