Beispiel #1
0
        private void enablePortSelection(string[] ports)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.connectButton.InvokeRequired || this.comportListBox.InvokeRequired)
            {
                EnablePortSelectionCallback d = new EnablePortSelectionCallback(enablePortSelection);
                this.Invoke(d, new object[] { ports });
            }
            else
            {
                foreach (string s in ports)
                {
                    this.comportListBox.Items.Add(s);
                }

                this.comportListBox.Visible = true;
                this.connectButton.Visible  = true;
            }
        }
Beispiel #2
0
        private void enablePortSelection(string[] ports)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.connectButton.InvokeRequired || this.comportListBox.InvokeRequired)
            {
                EnablePortSelectionCallback d = new EnablePortSelectionCallback(enablePortSelection);
                this.Invoke(d, new object[] { ports });
            }
            else
            {
                foreach (string s in ports)
                    this.comportListBox.Items.Add(s);

                this.comportListBox.Visible = true;
                this.connectButton.Visible = true;
            }
        }