private void Data_Initialize() { var portNames = SerialPort.GetPortNames(); // A4 and A5 page size ComboBox_Pagesize.Items.Clear(); ComboBox_Port1.Items.Clear(); ComboBox_Port2.Items.Clear(); ComboBox_Port3.Items.Clear(); ComboBox_Port4.Items.Clear(); ComboBox_Port5.Items.Clear(); ComboBox_Port6.Items.Clear(); ComboBox_input_data.Items.Clear(); ComboBox_BaudRate1.Items.Clear(); ComboBox_BaudRate2.Items.Clear(); ComboBox_BaudRate3.Items.Clear(); ComboBox_BaudRate4.Items.Clear(); ComboBox_BaudRate5.Items.Clear(); ComboBox_BaudRate6.Items.Clear(); ComboBox_Input_Baud.Items.Clear(); foreach (var portname in portNames) { ComboBox_Port1.Items.Add(portname.ToString()); ComboBox_Port2.Items.Add(portname.ToString()); ComboBox_Port3.Items.Add(portname.ToString()); ComboBox_Port4.Items.Add(portname.ToString()); ComboBox_Port5.Items.Add(portname.ToString()); ComboBox_Port6.Items.Add(portname.ToString()); ComboBox_Port6.Items.Add(portname.ToString()); ComboBox_input_data.Items.Add(portname.ToString()); } List <int> ListBaudRate = new List <int>(new int[] { 110, 300, 600, 1200, 2400, 4800, 9600, 14400 , 19200, 38400, 57600, 115200, 128000 }); List <string> Combobox_Baudrate = ListBaudRate.ConvertAll <string>(delegate(int i) { return(i.ToString()); }); foreach (var Baudrate in Combobox_Baudrate) { ComboBox_BaudRate1.Items.Add(Baudrate); ComboBox_BaudRate2.Items.Add(Baudrate); ComboBox_BaudRate3.Items.Add(Baudrate); ComboBox_BaudRate4.Items.Add(Baudrate); ComboBox_BaudRate5.Items.Add(Baudrate); ComboBox_BaudRate6.Items.Add(Baudrate); ComboBox_Input_Baud.Items.Add(Baudrate); } BitmapImage src = new BitmapImage(new Uri("pack://application:,,,/Resources/Global_Instrument_Logo.jpeg", UriKind.Absolute)); imgDynamic.Source = src; txt_compname.Text = SensorHelper_2.read_config_name(); txt_compaddr.Text = SensorHelper_2.read_config_addr(); //output = (val % 2 == 1) ? "Number is odd" : "Number is even"; if (String.IsNullOrEmpty(txt_compname.Text)) { txt_compname.Text = "Your Company Name"; } if (String.IsNullOrEmpty(txt_compaddr.Text)) { txt_compaddr.Text = "Your Company Address"; } //ComboBox_Pagesize.Items.Add("A4"); //ComboBox_Pagesize.Items.Add("A5"); ComboBox_Pagesize.SelectedValuePath = "Key"; ComboBox_Pagesize.DisplayMemberPath = "Value"; ComboBox_Pagesize.Items.Add(new KeyValuePair <int, string>(0, "A4 Portrait")); ComboBox_Pagesize.Items.Add(new KeyValuePair <int, string>(1, "2 copies of report in PDF (A4)")); ComboBox_Pagesize.Items.Add(new KeyValuePair <int, string>(2, "\"9.5\" x \"11\" (cnt form paper)")); ComboBox_Pagesize.Items.Add(new KeyValuePair <int, string>(3, "\"9.5\" x \"5.5\" (cnt form paper)")); /* * ComboBox_Pagesize.Items.Add("A4 Portrait"); * ComboBox_Pagesize.Items.Add("A5 Landscape"); * ComboBox_Pagesize.Items.Add("A4 Portrait Cnt Paper"); * ComboBox_Pagesize.Items.Add("A5 Landscape Cnt Paper"); */ /* * 1. A4 Portrait * 2. A5 Landscape * 3. A4 Portrait Cnt Paper * 4. A5 Landscape Cnt Paper */ SensorHelper_2.Generate_Initial_Folder(); }
public Company_data_window() { InitializeComponent(); txt_companyName.Text = SensorHelper_2.read_config_name(); txt_companyAddress.Text = SensorHelper_2.read_config_addr(); }