private void FillVideoComboBoxBasedOnCurrentFolder() { videoFiles = null; videoFilenames = null; videoComboBox.RemoveAll(); string folder = String.Empty; try { folder = (Dialog as FileChooserDialog).CurrentFolder; } catch (Exception e) { Logger.Error(e, "Caught exception when trying to get the current folder"); SetVideoSelectionSensitivity(false); return; } if ((folder == null) || (folder == String.Empty)) { Logger.Error("Error when trying to get the current folder."); SetVideoSelectionSensitivity(false); return; } videoFiles = VideoFiles.GetVideoFilesAtPath(folder); if ((videoFiles.Count == 0) || (videoFiles == null)) { SetVideoSelectionSensitivity(false); return; } else { SetVideoSelectionSensitivity(true); } videoFiles.Sort(); videoFilenames = new ArrayList(); foreach (string file in videoFiles) { string filename = Path.GetFileName(file); videoComboBox.AppendText(filename); videoFilenames.Add(FilenameWithoutExtension(filename)); } videoComboBox.PrependText("-"); videoComboBox.PrependText(Catalog.GetString("None")); videoComboBox.Active = 0; }
private void CreatePortSelLine() { Box conn_box = new Box(Orientation.Horizontal, 2); _pageContainer.Add(conn_box); conn_box.Add(new Label("Serial Port:")); _portNameCombo = new ComboBoxText(); _portNameCombo.Changed += Portname_Changed; conn_box.Add(_portNameCombo); PopulateSerialPortCombo(); conn_box.Add(new Label("Port baudrate:")); _baudRateCombo = new ComboBoxText(); conn_box.Add(_baudRateCombo); foreach (var bd_rate in Helpers.SerialRates) { _baudRateCombo.PrependText(bd_rate); } Button conn_btn = new Button(); conn_btn.Label = "Connect"; conn_btn.Clicked += BtnConnect_Click; conn_box.Add(conn_btn); Button disconn_btn = new Button(); disconn_btn.Label = "Disconnect"; disconn_btn.Clicked += BtnDisconnect_Click; conn_box.Add(disconn_btn); }
private void PopulateSerialPortCombo() { var ports = SiKInterface.GetSerialPorts(); ports.Add("<refresh>"); _portNameCombo.RemoveAll(); foreach (var pname in ports) { _portNameCombo.PrependText(pname); } }