
///////////////////////////////////////////////////////////////////////////////  
//文件名称: WinMultiProductTypeSelecter.xaml
//文件描述: WinMultiProductTypeSelecter.xaml
//创 建 者: xls
//创建日期: 2018/9/12 22:29:02
//版 本 号：1.0.0.0
////////////////////////////////////////////////////////////////////////////////

using System;
using System.Windows;
using System.Windows.Controls;
using Com.FirmLib.UI.Common;
using FWindSoft.Data;
using FWindSoft.Wpf;

namespace Com.FirmLib.UI.Seller
{
    /// <summary>
    /// WinMultiProductTypeSelecter.xaml 的交互逻辑
    /// </summary>
    public partial class WinMultiProductTypeSelector : BaseWindow
    {
        private VmMultiProductTypeSelector m_Vm;
        public WinMultiProductTypeSelector() : this(new VmMultiProductTypeSelector())
        {
          
        }
        public WinMultiProductTypeSelector(VmMultiProductTypeSelector vm)
        {
            InitializeComponent();
            this.m_Vm = vm;
            this.m_Vm.SetRefView(this);
            this.DataContext = this.m_Vm;
            this.Closing += WinMultiProductTypeSelector_Closing;
        }

        private void WinMultiProductTypeSelector_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.DialogResult = true;
        }

        protected override void LoadData(LoadParameter parameter)
        {
            //初始化列表数据
            TryCatchWrapper.Handled(() => this.m_Vm.Init(parameter));
        }
        #region 界面关联事件
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.HasError())
                {
                    //MessageShow.Infomation("请修改错误输入项");
                    return;
                }
            }
            catch (Exception ex)
            {
                
            }
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }
        #endregion

        private void DataGridRow_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DataGridRow row = sender as DataGridRow;
            if (row == null)
                return;
            this.m_Vm.Root.SetSelectedItem(row.Item as TreeNavigationItem<ShowDataItem>);
        }
    }
}
