/// <summary>
 /// 将选中的MAC过滤信息从列表中移除
 /// </summary>
 /// <param name="macFilterInfo">要移除的某个MAC地址过滤信息</param>
 private void RemoveMACFileterInfo(MACFilterInformation macFilterInfo)
 {
     if (_dpObj.CheckAccess())
         MACFilterInfoes.Remove(macFilterInfo);
     else
         _dpObj.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
             new MACFilterInfoDelegate(item => MACFilterInfoes.Remove(item)),
             macFilterInfo);
 }
        /// <summary>
        /// 显示并修改选中的MAC过滤信息
        /// </summary>
        /// <param name="macFilterInfo">选中的MAC过滤信息</param>
        public void ShowMACFilterInfo(MACFilterInformation macFilterInfo)
        {
            MACFilterInformation clone = (MACFilterInformation)macFilterInfo.Clone();
            MACFilterInfoWindow wnd = new MACFilterInfoWindow
            {
                Owner = Application.Current.MainWindow,
                DataContext = clone,
            };

            if (wnd.ShowDialog() == true)
            {
                ErrType err = _businessService.ModifyMACFilterInfo(_loginID, clone);
                if (err == GeneralErr.Success)
                    macFilterInfo.Sync(clone);
                else
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
 /// <summary>
 /// 删除选中的MAC过滤信息
 /// </summary>
 /// <param name="macFilterInfo">选中的MAC过滤信息</param>
 public void DeleteMACFilterInfo(MACFilterInformation macFilterInfo)
 {
     MessageBoxResult mbResult = MessageBox.Show("确认删除该条记录吗?", "删除确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
     if (mbResult == MessageBoxResult.Yes)
     {
         ErrType err = _businessService.DeleteMACFilterInfo(_loginID, macFilterInfo.FilterID);
         if (err == GeneralErr.Success)
             RemoveMACFileterInfo(macFilterInfo);
         else
             MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
        /// <summary>
        /// 执行添加MAC地址过滤信息的方法
        /// </summary>
        public void AddMACFilterInfoExecute()
        {
            MACFilterInformation macInfo = new MACFilterInformation();
            MACFilterInfoWindow wnd = new MACFilterInfoWindow
            {
                Owner = Application.Current.MainWindow,
                DataContext = macInfo,
            };

            if (wnd.ShowDialog() == true)
            {
                ErrType err = _businessService.AddMACFilterInfo(_loginID, macInfo);
                if (err == GeneralErr.Success)
                    AddMACFilterInfo(macInfo);
                else
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
 /// <summary>
 /// 同步MAC过滤信息
 /// </summary>
 /// <param name="clone">同步数据源</param>
 public void Sync( MACFilterInformation clone ) {
     MACAddress = clone.MACAddress;
     FilterDesc = clone.FilterDesc;
 }
 /// <summary>
 /// 修改选中的MAC地址过滤信息
 /// </summary>
 /// <param name="loginID">登陆标识</param>
 /// <param name="macFilterInfo">修改后的MAC地址过滤信息</param>
 /// <returns>ErrType</returns>
 public ErrType ModifyMACFilterInfo(string loginID, MACFilterInformation macFilterInfo)
 {
     try
     {
         TradeMac macInfo = MyConverter.ToTradeMac(macFilterInfo);
         ResultDesc result = ManagerService.ModifyTradeMac(macInfo, loginID);
         return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
     }
     catch (TimeoutException te)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
      new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
     }
 }
 internal static TradeMac ToTradeMac(MACFilterInformation macInfo)
 {
     return new TradeMac
     {
         MAC = macInfo.MACAddress,
         Desc = macInfo.FilterDesc,
         ID = macInfo.FilterID,
     };
 }
 /// <summary>
 /// 同步MAC过滤信息
 /// </summary>
 /// <param name="clone">同步数据源</param>
 public void Sync(MACFilterInformation clone)
 {
     MACAddress = clone.MACAddress;
     FilterDesc = clone.FilterDesc;
 }