CCManager.MainForm.PopulateSerialPortList(System.Windows.Forms.ComboBox)

Here are the examples of the csharp api class CCManager.MainForm.PopulateSerialPortList(System.Windows.Forms.ComboBox) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: CCManager
Source File: MainForm.cs
string GetSerialPortViaPicker()
		{
			Form pickerDialog = new Form();
			pickerDialog.Text = "Select a serial port";
			pickerDialog.StartPosition = FormStartPosition.CenterScreen;
			pickerDialog.Height = 80;
			pickerDialog.Width = 220;
			pickerDialog.ShowIcon = false;
			pickerDialog.MaximizeBox = false;
			pickerDialog.MinimizeBox = false;
			pickerDialog.FormBorderStyle = FormBorderStyle.FixedSingle;
			
			ComboBox cbSerialPortPicker = new ComboBox();
			cbSerialPortPicker.Width = 90;
			cbSerialPortPicker.DropDownStyle = ComboBoxStyle.DropDownList;
			cbSerialPortPicker.Location = new Point(20, 15);
			PopulateSerialPortList(cbSerialPortPicker);
			pickerDialog.Controls.Add(cbSerialPortPicker);
			
			Button btnOk = new Button();
			btnOk.Text = "OK";
			btnOk.DialogResult = DialogResult.OK;
			btnOk.Location = new Point(120, 14);
			
			pickerDialog.Controls.Add(btnOk);
			
			if (pickerDialog.ShowDialog() == DialogResult.OK)
			{
				return cbSerialPortPicker.Text;
			}
			else 
			{
				string errorMessage = "No serial port picked! Exiting..";
				Log.Error(errorMessage);
				MessageBox.Show(errorMessage);
				Environment.Exit(0);
			}
			return null;
		}