Beispiel #1
0
        private void EnableControls(bool enable)
        {
            if (this.textBoxText.InvokeRequired)
            {
                EnableControlsCallback enableControlsCallback = new EnableControlsCallback(EnableControls);
                Invoke(enableControlsCallback, new object[] { enable });
            }
            else
            {
                this.textBoxText.ReadOnly                   = !enable;
                this.toolStripButtonSendOnce.Enabled        = enable;
                this.toolStripButtonSendForever.Enabled     = enable;
                this.toolStripButtonCancel.Enabled          = !enable;
                this.toolStripDropDownButtonConvert.Enabled = enable;
                this.toolStripButtonOptions.Enabled         = enable;

                if (enable)
                {
                    this.textBoxText.SelectionStart  = selectionStart;
                    this.textBoxText.SelectionLength = selectionLength;
                }
                else
                {
                    selectionStart  = this.textBoxText.SelectionStart;
                    selectionLength = this.textBoxText.SelectionLength;
                }

                this.toolStripStatusLabelCurrent.Visible = !enable;
            }
        }
Beispiel #2
0
        private void EnableControls(bool enable)
        {
            if (this.textBoxText.InvokeRequired)
            {
                EnableControlsCallback enableControlsCallback = new EnableControlsCallback(EnableControls);
                Invoke(enableControlsCallback, new object[] { enable });
            }
            else
            {
                this.textBoxText.ReadOnly = !enable;
                this.toolStripButtonSendOnce.Enabled = enable;
                this.toolStripButtonSendForever.Enabled = enable;
                this.toolStripButtonCancel.Enabled = !enable;
                this.toolStripDropDownButtonConvert.Enabled = enable;
                this.toolStripButtonOptions.Enabled = enable;

                if (enable)
                {
                    this.textBoxText.SelectionStart = selectionStart;
                    this.textBoxText.SelectionLength = selectionLength;
                }
                else
                {
                    selectionStart = this.textBoxText.SelectionStart;
                    selectionLength = this.textBoxText.SelectionLength;
                }

                this.toolStripStatusLabelCurrent.Visible = !enable;
            }
        }