Example #1
0
        void Frm_MonitorConfigManager_LedScreenChangedEvent(object sender, EventArgs e)
        {
            if (!this.InvokeRequired)
            {
                comboBox_Screen.DataSource = null;
                _vm.CmdInitialize.Execute(null);
                comboBox_Screen.DataSource    = _vm.LedInfos;
                comboBox_Screen.DisplayMember = "Name";
                comboBox_Screen.ValueMember   = "Data";

                if (_vm.LedInfos == null || _vm.LedInfos.Count == 0)
                {
                    ControlEnabled(false);
                }
                else
                {
                    ControlEnabled(true);
                }
            }
            else
            {
                while (!this.IsHandleCreated)
                {
                    if (this == null || this.IsDisposed)
                    {
                        return;
                    }
                }
                Frm_LedScreenChangedEvent frm_ledChangedEvent = new Frm_LedScreenChangedEvent(Frm_MonitorConfigManager_LedScreenChangedEvent);
                this.Invoke(frm_ledChangedEvent, new object[] { sender, e });
            }
        }
        void Frm_MonitorConfigManager_LedScreenChangedEvent(object sender, EventArgs e)
        {
            if (!this.InvokeRequired)
            {
                comboBox_Screen.DataSource = null;
                _vm.CmdInitialize.Execute(null);
                comboBox_Screen.DataSource = _vm.LedInfos;
                comboBox_Screen.DisplayMember = "Name";
                comboBox_Screen.ValueMember = "Data";

                if (_vm.LedInfos == null || _vm.LedInfos.Count == 0)
                {
                    ControlEnabled(false);
                }
                else
                {
                    ControlEnabled(true);
                }
            }
            else
            {
                while (!this.IsHandleCreated)
                {
                    if (this == null || this.IsDisposed)
                    {
                        return;
                    }
                }
                Frm_LedScreenChangedEvent frm_ledChangedEvent = new Frm_LedScreenChangedEvent(Frm_MonitorConfigManager_LedScreenChangedEvent);
                this.Invoke(frm_ledChangedEvent, new object[] { sender, e });
            }
        }