/// <summary> Загружаем торгуемые элементы из файла </summary> private void LoadListTradeSec() { System.IO.StreamReader openFile = new System.IO.StreamReader(@"market.list", true); ComboBox.ObjectCollection items = new ComboBox.ObjectCollection(comboBoxSelSec); items.Add(""); while (!openFile.EndOfStream) { string line = openFile.ReadLine(); if (!line.Empty()) { string[] el = line.Split(':'); if (el.Length > 0) { if (!el[0].Empty() && !el[1].Empty()) { var sec = Trader.Objects.Securities.FirstOrDefault(s => s.Code == el[0] && s.Class.Code == el[1]); if (sec.NotIsNull()) { items.Add(sec); } } } } } openFile.Close(); comboBoxSelSec.DataSource = items; comboBoxSelSec.SelectedIndex = 0; }
//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// #region Serial port /// <summary> /// Updates toolStripMenuItemSerialPort DropDownItems to include all available serial port. /// </summary> private void RefreshSerialPortAList() { ComboBox.ObjectCollection comboBoxCollection = comboBoxPortA.Items; comboBoxCollection.Clear(); comboBoxCollection.Add("Refresh List"); foreach (string portName in System.IO.Ports.SerialPort.GetPortNames()) { comboBoxCollection.Add("COM" + Regex.Replace(portName.Substring("COM".Length, portName.Length - "COM".Length), "[^.0-9]", "\0")); } }
public void Aggregate(ComboBox.ObjectCollection input, int countItems, int step) { for (int i = 0; i < countItems; i += step) { if (i < 10) { input.Add("0" + i.ToString()); } else { input.Add(i.ToString()); } } }
private void ProjConf_Load(object sender, EventArgs e) { lv_confs.FullRowSelect = true; c_rtl.DropDownStyle = ComboBoxStyle.DropDownList; ComboBox.ObjectCollection items = c_rtl.Items; for (int i = 0; i < RtlType.models.GetLength(0); ++i) { items.Add(RtlType.models[i].ToString()); } ListView.ColumnHeaderCollection headers = lv_confs.Columns; int width = lv_confs.Width; headers[COL_WARN].Width = 3 * width / 100; headers[COL_CTYPE].Width = 10 * width / 100; headers[COL_PLATFORM].Width = 6 * width / 100; headers[COL_CNAME].Width = 15 * width / 100; headers[COL_RTL_NAME].Width = 25 * width / 100; headers[COL_OUT_DIR].Width = 39 * width / 100; lv_confs.ListViewItemSorter = new ListWholeComparer(); lv_confs.ColumnClick += new ColumnClickEventHandler(ColumnClick); if (Program.g_args.Length > 0) { string name = Program.g_args[0]; open_project(name); } }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method populates the specified <see cref="ComboBox" /> item /// list with the recognized ADO.NET provider names. This method will /// only work correctly when called from the user-interface thread. /// </summary> /// <param name="items"> /// The <see cref="ComboBox.Items" /> property value containing the /// list of items to be modified. This value cannot be null. /// </param> /// <returns> /// The number of items actually added to the list, which may be zero. /// </returns> public static int AddProviderNames( ComboBox.ObjectCollection items ) { int result = 0; if (items == null) { return(result); } IList <string> names = new List <string>(); #if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 names.Add(Ef6ProviderName); #endif names.Add(LegacyProviderName); foreach (string name in names) { if (CheckProviderName(name)) { items.Add(name); result++; } } return(result); }
private void PopulateCCDList(ComboBox.ObjectCollection l) { for (var i = 0; i < _coreCount; i++) { l.Add(new CoreListItem(i / 8, i / 4, i)); } }
public FFTypeDescriptor SetContext([CanBeNull] object obj, [CanBeNull] IEnumerable <ITitled> scope, [CanBeNull] Action <object, FFTypeDescriptor> onSelectedObjectChanged) { _SelectedObjectChanged = onSelectedObjectChanged; ComboBox.ObjectCollection items = cbScope.Items; items.Clear(); if (cbScope.Enabled = scope != null && obj != null) { foreach (var t in scope) { items.AddTitledItem(t); } } else { var t = obj as ITitled; if (t != null) { items.AddTitledItem(t); } else { if (obj != null) { items.Add(obj.ToString()); } } } return(SetCurrentObject(obj)); }
// Add string to ComboBox dropdown at end // loops back to top if list grows past max size (extHistoryMax) private void MonitorExtDropdownAdd(string str) { // check that string isn't empty if (str.Length <= 0) { return; } // convert str to lowercase str = str.ToLower(); // pull Items from control ComboBox.ObjectCollection extComboList = ComboBoxMonitorExt.Items; // check that string is not equal to current value at end // check if list contains anything // could use IndexOf(str), but don't want to deal with if it starts at the end or beginning of the collection if (extComboList.Count > 0) { // check if equals, return if (str == (string)extComboList[extComboList.Count - 1]) { return; } } // if size is at max, remove first entry if (extComboList.Count == extHistoryMax) { extComboList.RemoveAt(0); } // add to items extComboList.Add(str); }
/// <summary> /// Adds item prevent having duplicates. /// </summary> /// <param name="receiver">List to add</param> /// <param name="add">Item to add</param> public static void SafeAdd(ComboBox.ObjectCollection receiver, string add) { if (!FindDuplicates(receiver, add)) { receiver.Add(add); } }
PopulateVertexComboBox ( ComboBox cbxVertex ) { Debug.Assert(cbxVertex != null); AssertValid(); // Save the ObjectWithText that is selected in the vertex ComboBox, if // there is one. ObjectWithText oOldSelectedObjectWithText = (ObjectWithText)cbxVertex.SelectedItem; ComboBox.ObjectCollection oItems = cbxVertex.Items; oItems.Clear(); foreach (DataGridViewRow oDataGridViewRow in dgvSourceColumns.Rows) { if ((Boolean)oDataGridViewRow.Cells[IsEdgeColumnIndex].Value) { oItems.Add((ObjectWithText)oDataGridViewRow.Cells[ ColumnNameIndex].Value); } } cbxVertex.SelectedItem = oOldSelectedObjectWithText; }
public void Add(uint iProcessID, uint iCharacterID, string zName, byte iLevel) { ComboBox.ObjectCollection items = this.List.Items; // ISSUE: variable of a boxed type var local = (ValueType)iProcessID; string str1 = ": "; string str2; if (zName != null && zName.Length != 0) { str2 = string.Concat(new object[4] { (object)zName, (object)" (", (object)iLevel, (object)")" }); } else { str2 = "No character information."; } string str3 = (string)(object)local + (object)str1 + str2; items.Add((object)str3); this._hProcessList.Add(iProcessID); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; if (context != null && context.Instance != null && provider != null) { editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { CustomPropertyCollection cbx = (CustomPropertyCollection)context.Instance; ComboBox.ObjectCollection coc = (ComboBox.ObjectCollection)cbx[6].Value; FormComboBoxItem form2 = new FormComboBoxItem(); if (null != coc && coc.Count > 0) { form2.ExplainData = coc[0] as ComboBoxItemData; } if (DialogResult.OK == editorService.ShowDialog(form2)) { coc.Clear(); coc.Add(form2.ExplainData); value = coc; } return(value); } } return(value); }
public static void AddAll <T>(this ComboBox.ObjectCollection self, IEnumerable <T> es) { foreach (var e in es) { self.Add(e); } }
public static void AddNotExists(this ComboBox.ObjectCollection items, object value) { if (items.Contains(value)) { return; } items.Add(value); }
private void PopulateFrequencyList(ComboBox.ObjectCollection l) { for (var i = 1800; i <= 4000; i += 50) { var v = i / 1000.00; l.Add(new FrequencyListItem(i, $"{v:0.00} GHz")); } }
public static void CopyToFromObjectCollection(ComboBox.ObjectCollection fromItems, ComboBox.ObjectCollection toItems) { toItems.Clear(); for (int i = 0; i < fromItems.Count; i++) { toItems.Add(fromItems[i]); } }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { if (this.tabControl1.SelectedIndex == 0) { this.currentSet.skill = this.copySet.skill; this.file.css[this.cbChar.SelectedIndex] = this.currentSet; this.lck = false; int selectedIndex = this.cbChar.SelectedIndex; this.cbChar.SelectedIndex = 0; this.cbChar.Items.Clear(); for (int index = 0; index < this.file.css.Count; ++index) { ComboBox.ObjectCollection items = this.cbChar.Items; string str1 = "Character "; charSkillSet charSkillSet = this.file.css[index]; string str2 = charSkillSet.charID.ToString("000"); string str3 = " - Costume "; charSkillSet = this.file.css[index]; string str4 = charSkillSet.costumeID.ToString("00"); string str5 = str1 + str2 + str3 + str4; items.Add((object)str5); } this.cbChar.SelectedIndex = selectedIndex; this.lck = true; } else { this.currentSkill = this.copySkill; this.UpdateCurrentSkill(); this.UpdateSkillList(); this.lck = false; this.txtShortName.Text = this.currentSkill.shortName; this.txtid.Text = this.currentSkill.id.ToString(); this.txtid2.Text = this.currentSkill.id2.ToString(); this.textBox1.Text = this.currentSkill.racelock.ToString(); this.txt1.Text = this.currentSkill.unk1.ToString(); this.txt2.Text = this.currentSkill.unk2.ToString(); this.txtHair.Text = this.currentSkill.hair.ToString(); this.txt3.Text = this.currentSkill.unk3.ToString(); this.txt4.Text = this.currentSkill.Paths[0]; this.txt5.Text = this.currentSkill.Paths[1]; this.txt6.Text = this.currentSkill.Paths[2]; this.txt7.Text = this.currentSkill.Paths[3]; this.txt8.Text = this.currentSkill.Paths[4]; this.txt9.Text = this.currentSkill.Paths[5]; this.txt10.Text = this.currentSkill.Paths[6]; this.txt11.Text = this.currentSkill.unk4.ToString(); this.txt12.Text = this.currentSkill.unk5.ToString(); this.txt13.Text = this.currentSkill.unk6.ToString(); this.txt14.Text = this.currentSkill.unk7.ToString(); this.txt15.Text = this.currentSkill.unk8.ToString(); this.txt16.Text = this.currentSkill.unk9.ToString(); this.txt17.Text = this.currentSkill.unk10.ToString(); this.txt18.Text = this.currentSkill.unk11.ToString(); this.lck = true; } this.lblStatus.Text = "Data has been pasted in"; }
//private void SetStatus(string s) //{ // statusLabel.Text = s; //} private void PopulateStatusComboBox(ComboBox.ObjectCollection collection) { var values = Enum.GetValues(typeof(RecordStatus)); foreach (var value in values) { collection.Add(value.ToString()); } }
public static void FillComboBox(ComboBox.ObjectCollection Items, string commandString, string CustomInitialDisplayValue) { Items.Clear(); OleDbCommand command = new OleDbCommand(commandString, dbConnection); OleDbDataReader reader = command.ExecuteReader(); if (CustomInitialDisplayValue != null) { Items.Add(CustomInitialDisplayValue); } while (reader.Read()) { Items.Add(GetString(reader[0])); } reader.Close(); }
public void RequeryCategories() { object selected = cmbSelectedCategory.SelectedItem; // Keep as object for null coalescing. ComboBox.ObjectCollection items = cmbSelectedCategory.Items; ARKDataSet.EngramCategoriesDataTable categories = new ARKDataSet.EngramCategoriesDataTable(); engramCategoriesTableAdapter.Fill(aRKDataSet.EngramCategories); engramCategoriesTableAdapter.Fill(categories); items.Clear(); items.Add(EngramCategoryEntry.ShowAll); foreach (ARKDataSet.EngramCategoriesRow row in categories) { items.Add(new EngramCategoryEntry(row)); } cmbSelectedCategory.SelectedItem = selected ?? EngramCategoryEntry.ShowAll; // Engrams get requeried when --^ changes. }
/// <summary> /// Initializes a new instance of the <see cref="QAVerificationForm"/> class. /// </summary> /// <param name="domainTransactionManager">The domain transaction manager.</param> public QAVerificationForm( [NotNull] IDomainTransactionManager domainTransactionManager) { Assert.ArgumentNotNull(domainTransactionManager, nameof(domainTransactionManager)); _domainTransactionManager = domainTransactionManager; InitializeComponent(); ComboBox.ObjectCollection items = _toolStripComboBoxView.Items; _viewIndexGridConditions = items.Add("Quality Conditions"); _viewIndexGridDatasets = items.Add("Verified Datasets"); _viewIndexTreeLayers = items.Add("Quality Conditions by Dataset"); _viewIndexTreeHierarchic = items.Add("Quality Conditions by Involved Datasets"); _viewIndexTreeConditionsByCategory = items.Add(("Quality Conditions by Category")); _toolStripComboBoxView.SelectedIndex = _viewIndexGridConditions; _formStateManager = new FormStateManager <QAVerificationFormState>(this); }
private void UpdateVersions() { if (InvokeRequired) { Invoke(_updateVersionsDelegate); } else { ComboBox.ObjectCollection items = versionBox.Items; items.Clear(); items.Add("Latest"); _versions.Sort(); _versions.Reverse(); foreach (string s in _versions) { items.Add(s); } versionBox.SelectedIndex = 0; } }
public MuseumCollections() { InitializeComponent(); ComboBox.ObjectCollection objectCollection = new ComboBox.ObjectCollection(comboBox1); objectCollection.Add("Click to Select"); objectCollection.AddRange(setNames.ToArray()); myCollection.AddRange(setNames.ToArray()); comboBox1.AutoCompleteCustomSource = myCollection; comboBox1.DataSource = objectCollection; comboBox1.DisplayMember = "Click to Select"; }
private void SetCurrentPorts() { comboBoxPorts.DataSource = null; ComboBox.ObjectCollection itemsPorts = new ComboBox.ObjectCollection(comboBoxPorts); foreach (var port in SignalPort.GetListPorts()) { itemsPorts.Add(port); } comboBoxPorts.DataSource = itemsPorts; comboBoxPorts.DropDownStyle = ComboBoxStyle.DropDownList; }
private void arrayCheckBoxToComboItems(CheckBox [] arrayCheckBox, ComboBox.ObjectCollection items) { items.Clear(); for (int i = 1; i < arrayCheckBox.Length; i++) { if (arrayCheckBox[i].Checked) { items.Add(arrayCheckBox[i].Text); } } }
private void Btn_valider_Click(object sender, EventArgs e) { switch (this.state) { case state.added: Course c = new Course(lc.LastID, Convert.ToInt32(tb_distance.Text), tb_nom.Text, Convert.ToInt32(tb_prix.Text), Convert.ToInt32(tb_te.Text), this.state); this.lc.Add(c); items.Add(c); break; } this.Close(); }
private void ResortComboBoxItemCollection(ComboBox.ObjectCollection coll) { var oAList = new ArrayList(coll); oAList.Sort(new ComboBoxItemComparer()); coll.Clear(); foreach (object oItem in oAList) { coll.Add(oItem); } }
private void PopulatePresets() { PresetInfo info; ComboBox.ObjectCollection items = cbPresets.Items; info = new PresetInfo("Blinds", "(rint(4*x-y*2) % 2) - x", "(abs(x+2*y) % 0.75)*10+y/5", "rint(sin(sqrt(x*x+y*y))*3/5)+x/3"); items.Add(info); info = new PresetInfo("Bullseye", "1-rint(x/y*0.5)", "1-rint(y/x*0.4)", "rint(sin(sqrt(x*x+y*y)*10))"); items.Add(info); info = new PresetInfo("Wave", "cos(x/2)/2", "cos(y/2)/3", "rint(sin(sqrt(x*x*x+y*y)*10))"); items.Add(info); info = new PresetInfo("Swirls", "x*15", "cos(x*y*4900)", "y*15"); items.Add(info); info = new PresetInfo("Mod", "(x ^2) % y", "y % x", "x % y"); items.Add(info); info = new PresetInfo("Simple", "x", "y", "x+y"); items.Add(info); cbPresets.SelectedIndex = 0; }
public static void FillComboBoxValuesInt(ComboBox.ObjectCollection Items, string commandString, string CustomInitialDisplayValue) { Items.Clear(); OleDbCommand command = new OleDbCommand(commandString, dbConnection); OleDbDataReader reader = command.ExecuteReader(); if (CustomInitialDisplayValue != null) { Items.Add(CustomInitialDisplayValue); } while (reader.Read()) { ListItem newListItem = new ListItem(); newListItem.Text = reader.GetInt32(0).ToString(); newListItem.Value = reader.GetInt32(1).ToString(); Items.Add(newListItem); } reader.Close(); }
private void PopulateVoltageList(ComboBox.ObjectCollection l) { for (var i = 12; i < 128; i += 1) { var voltage = (decimal)(1.55 - i * 0.00625); int decimals = CountDecimals(voltage); if (decimals <= 3) { l.Add(new VoltageListItem(i, (double)voltage)); } } }