后台线程下的WinFrom窗体控件操作 Invoke

Invoke(new MethodInvoker(delegate { ControllerLogout(controller_id, is_successful, description, controller); }));
  /// <summary>
        /// 控制器退出
        /// </summary> 
        private void ControllerLogout(int controller_id, bool is_successful, string description, EbtController controller)
        {
            if (is_successful)
            {
                if (plChannel.Controls == null)
                    return;
                foreach (Control control in plChannel.Controls)
                {
                    EbtControl ebtcontrol = control as EbtControl;
                    if (ebtcontrol != null && ebtcontrol.ChannelInfo.PhoneConfiguration.DataID == controller_id)
                    {
                        ebtcontrol.Enabled = false;
                        ebtcontrol.Controller = null;
                    }
                }
                AddLogRecord(new LogRecord(DateTime.Now, LogGrade.信息, LogType.外围系统, "电话控制器", description));
            }
            else
            {
                AddLogRecord(new LogRecord(DateTime.Now, LogGrade.警告, LogType.外围系统, "电话控制器", description));
            }
        }

 

posted @ 2016-12-29 12:08  释迦苦僧  阅读(373)  评论(0编辑  收藏  举报