|
@@ -19,6 +19,28 @@ namespace RF_TRIO_PLL_ZIG
|
19
|
19
|
Data_Handler data_Handler = new Data_Handler();
|
20
|
20
|
//FileDownload fileDownload;
|
21
|
21
|
Update_Serial fileDownload = null;
|
|
22
|
+ public void SetPortNameValues(object obj)
|
|
23
|
+ {
|
|
24
|
+ string[] ports = SerialPort.GetPortNames(); // load all name of com ports to string
|
|
25
|
+ try
|
|
26
|
+ {
|
|
27
|
+ ((ComboBox)obj).Items.Clear(); //delete previous names in combobox items
|
|
28
|
+ }
|
|
29
|
+ catch { }
|
|
30
|
+ ((ComboBox)obj).DataSource = null;
|
|
31
|
+ foreach (string port in ports) //add this names to comboboxPort items
|
|
32
|
+ {
|
|
33
|
+ ((ComboBox)obj).Items.Add(port); //if there are some com ports ,select first
|
|
34
|
+ }
|
|
35
|
+ if (((ComboBox)obj).Items.Count > 0)
|
|
36
|
+ {
|
|
37
|
+ ((ComboBox)obj).SelectedIndex = 0;
|
|
38
|
+ }
|
|
39
|
+ else
|
|
40
|
+ {
|
|
41
|
+ ((ComboBox)obj).Text = " "; //if there are no com ports ,write Empty
|
|
42
|
+ }
|
|
43
|
+ }
|
22
|
44
|
public void Serial_Initialize(ref ComboBox cb_port)
|
23
|
45
|
{
|
24
|
46
|
|