/// <summary> /// Setup the initial privileges /// </summary> /// <param name="role"></param> private void initPriv(privRole role) { switch (role) { case privRole.user: CheckedListBox.ObjectCollection uitem = clbUserPriv.Items; int uindex = 0; foreach (KeyValuePair <string, bool> entry in config.InitData.UserPriv) { uitem.Insert(uindex, entry.Key); clbUserPriv.SetItemChecked(uindex, entry.Value); uindex++; } break; case privRole.admin: CheckedListBox.ObjectCollection aitem = clbAdminPriv.Items; int aindex = 0; foreach (KeyValuePair <string, bool> entry in config.InitData.AdminPriv) { aitem.Insert(aindex, entry.Key); clbAdminPriv.SetItemChecked(aindex, entry.Value); aindex++; } break; } }
public void Show() { CheckedListBox.ObjectCollection items = this.hiddenNodeList.Items; List <object> nodesToRemove = new List <object> ( from object item in items where (!this.curCategoryTypes.Contains(item.ToString())) select item); foreach (object node in nodesToRemove) { items.Remove(node); } foreach (string type in this.curCategoryTypes) { if (!items.Contains(type)) { items.Add(type); if (this.categoryTypeStatus[type]) { this.hiddenNodeList.SetItemChecked(items.IndexOf(type), true); } } } }
internal MsgBox_CheckBoxes(string message, string caption, List <string> DataSource, string buttonText, CBDisplayType type = CBDisplayType.GRID) { InitializeComponent(); currentType = type; label1.Text = message; if (currentType == CBDisplayType.GRID) { for (int i = 0; i < DataSource.Count; i++) { CheckBox checkBox = new CheckBox(); checkBox.Name = "CheckBox_" + i; checkBox.Text = DataSource[i]; checkBoxes.Add(checkBox); } flowLayoutPanel1.Controls.AddRange(checkBoxes.ToArray()); this.Size = new Size(this.Size.Width, 150 + 35 * (int)Math.Ceiling((double)(checkBoxes.Count / 3))); } else { clb = new CheckedListBox(); CheckedListBox.ObjectCollection oc = clb.Items; for (int i = 0; i < DataSource.Count; i++) { oc.Add(DataSource[i]); } clb.Dock = DockStyle.Fill; clb.CheckOnClick = true; tableLayoutPanel1.Controls.RemoveByKey("flowLayoutPanel1"); tableLayoutPanel1.Controls.Add(clb, 1, 1); this.Size = new Size(this.Size.Width, 100 + clb.Size.Height); } button1.Text = buttonText; }
/// <summary> /// 全选(true)或全不选(false)所有的表格和视图. /// </summary> /// <param name="select">选择状态</param> private void SelectOrUnselectAllTablesAndViews(bool select) { //得到列表中的所有的项. CheckedListBox.ObjectCollection collection = this.clbTablesAndView.Items; //将列表项内容缓存到数组中. string[] items = new string[collection.Count]; int i = 0; foreach (Object item in collection) { items[i] = item.ToString(); i++; } //清除列表中的内容. this.clbTablesAndView.Items.Clear(); //将缓存的内容以指定的选中状态加载到列表中. foreach (Object item in items) { this.clbTablesAndView.Items.Add(item, select); } //默认选中第一项. if (this.clbTablesAndView.Items.Count > 0) { this.clbTablesAndView.SelectedIndex = 0; } }
DoDataExchange ( Boolean bFromControls ) { AssertValid(); if (bFromControls) { GraphMetrics eGraphMetricsToCalculate = GraphMetrics.None; foreach (Object oCheckedItem in clbGraphMetrics.CheckedItems) { eGraphMetricsToCalculate |= ItemToGraphMetricInformation(oCheckedItem).GraphMetric; } m_oGraphMetricUserSettings.GraphMetricsToCalculate = eGraphMetricsToCalculate; } else { CheckedListBox.ObjectCollection oItems = clbGraphMetrics.Items; Int32 iItems = oItems.Count; for (Int32 i = 0; i < iItems; i++) { clbGraphMetrics.SetItemChecked(i, m_oGraphMetricUserSettings.ShouldCalculateGraphMetrics( ItemToGraphMetricInformation(oItems[i]).GraphMetric)); } } return(true); }
//When checked selected all of the non-system databases. private void chckbx_select_all_non_system_CheckedChanged(object sender, EventArgs e) { bool isChecked = chckbx_select_all_non_system.Checked; CheckedListBox.ObjectCollection items = checkedListBox_databases.Items; for (int i = 0; i < items.Count; i++) { string itemName = items[i].ToString(); if (!userDatabaseNames.Contains(itemName)) { continue; } checkedListBox_databases.SetItemChecked(i, isChecked); //Select all non-system databases. if (selectedDatabaseNames.ContainsKey(itemName)) { selectedDatabaseNames[itemName] = isChecked; } else { selectedDatabaseNames.Add(items[i].ToString(), isChecked); } } btn_start.Enabled = selectedDatabaseNames.Any(x => x.Value == true); }
public static void InsertRange(this CheckedListBox.ObjectCollection collection, int index, object[] array) { var i = 0; while (i < array.Length) { collection.Insert(index++, array[i++]); } }
private static void UpdateProviderList(CheckedListBox.ObjectCollection items, string targetServer = null) { if (Providers == null) { Providers = new System.Collections.Generic.List <string>(SystemEventEnumerator.GetEventProviders(targetServer, null, true)); } items.Clear(); items.AddRange(Providers.ConvertAll <DropDownCheckListItem>(s => { var p = s.Split('|'); return(new DropDownCheckListItem(p[1], p[0])); }).ToArray()); }
private void CheckedListBoxItemsInitialization() { CheckedListBox.ObjectCollection clbSortersItems = clbSorters.Items; for (int i = 0; i < _formModel.LoadedSorters.Count; i++) { clbSortersItems.Add(_formModel.LoadedSorters[i].ToString()); } }
public void SyncCartObjectWithInterfaceList(CheckedListBox.ObjectCollection listItems) { Cart cart = new Cart(); foreach (CartItem item in listItems) { cart.CartItems.Add(item); } Global.Cart = cart; }
internal static T[] ToArray <T>(this CheckedListBox.ObjectCollection list) where T : INHydrateModelObject { var retval = new List <T>(); foreach (T o in list) { retval.Add(o); } return(retval.ToArray()); }
public void initTableList() { CheckedListBox.ObjectCollection items = chkTableList.Items; items.Add("competition_data"); items.Add("match_data"); items.Add("robot_data"); items.Add("team_data"); items.Add("team_match"); chkTableList.Refresh(); }
public void initTableList() { CheckedListBox.ObjectCollection items = chkTableList.Items; items.Add(ActionTypeTable.TABLE_NAME); items.Add(EventTable.TABLE_NAME); items.Add(MatchTable.TABLE_NAME); items.Add(TeamTable.TABLE_NAME); items.Add(TeamMatchTable.TABLE_NAME); chkTableList.Refresh(); }
private bool itemsIsInList(CheckedListBox.ObjectCollection items, string newItem) { foreach (string item in items) { if (item.ToUpper() == newItem.ToUpper()) { return(true); } } return(false); }
private bool containsTask(string newTask, CheckedListBox.ObjectCollection currentTasks) { foreach (string task in currentTasks) { if (task.ToLower() == newTask.ToLower()) { return(true); } } return(false); }
private void None_CheckedChanged(object sender, EventArgs e) { if (none.Checked) { CheckedListBox.ObjectCollection all = checkedListBox1.Items; int cnt = all.Count; for (int i = 0; i < cnt; i++) { checkedListBox1.SetItemChecked(i, false); } } }
public void UpdateNode(CheckedListBox.ObjectCollection items) { base.Text = this._packName; base.Nodes.Clear(); if (items != null && items.Count > 0) { for (int i = 0; i < items.Count; i++) { base.Nodes.Add(new SpawnPackSubNode((string)items[i])); } } }
private List <Speaker> buildSpeakerListFromCheckedListBox(CheckedListBox.ObjectCollection collection) { // Creates a safe list of existing speakers // Assumes the speakers in the list box actually exist in the data base List <Speaker> speakerList = new List <Speaker>(); foreach (string name in collection) { speakerList.Add(Utils.GetAllSpeakers().Find(speaker => speaker.Name == name)); } return(speakerList); }
public void UpdateNode(CheckedListBox.ObjectCollection items) { this.Text = this._packName; this.Nodes.Clear(); if (items == null || items.Count <= 0) { return; } for (int index = 0; index < items.Count; ++index) { this.Nodes.Add((TreeNode) new SpawnPackSubNode((string)items[index])); } }
/// <summary> /// Collect Selected Item Value List From CheckedListBox Control /// </summary> /// <typeparam name="T"></typeparam> /// <param name="checkedListBoxItems"></param> /// <param name="selectedItemList"></param> public static void CollectSelectedItemList <T>(CheckedListBox.ObjectCollection checkedListBoxItems, List <T> selectedItemList) { foreach (CheckedItem checkedItem in checkedListBoxItems) { if (checkedItem.Value != null && checkedItem.Value != DBNull.Value) { if (checkedItem.CurrentChecked) { selectedItemList.Add((T)Convert.ChangeType(checkedItem.Value, typeof(T), CultureInfo.InvariantCulture)); } } } }
public static CheckedListBox.ObjectCollection UncheckedItems(this CheckedListBox lb) { var uchkItms = new CheckedListBox.ObjectCollection(lb); for (int i = 0; i < lb.Items.Count; i++) { if (!lb.GetItemChecked(i)) { uchkItms.Add(lb.Items[i]); } } return(uchkItms); }
/// <summary> /// Collect Selected Item List From CheckedListBox Control /// </summary> /// <param name="checkedListBoxItems"></param> /// <param name="selectedItemList"></param> public static void CollectSelectedItemList(CheckedListBox.ObjectCollection checkedListBoxItems, List <CheckedItem> selectedItemList) { foreach (CheckedItem checkedItem in checkedListBoxItems) { if (checkedItem.Value != null && checkedItem.Value != DBNull.Value) { if (checkedItem.CurrentChecked) { selectedItemList.Add(checkedItem); } } } }
public void SetColorOnSeat(CheckedListBox.ObjectCollection items) { foreach (var ticket in items) { foreach (var label in labels) { if ((string)ticket == label.Text) { label.BackColor = Color.LightGreen; } } } }
private string getOutputFilename(CheckedListBox.ObjectCollection objectCollection) //V111 { string outputFilename = "Obfuscated"; foreach (string item in objectCollection) { if (item.EndsWith(".exe")) { string exe = item.Substring(item.LastIndexOf('\\')); return(outputFilename + exe); } } return(""); //outputFilename; }
protected override bool ValueToControl(object value) { CheckedListBox ckListBox = (CheckedListBox)_control; IEnumerable <string> checkedItems = (IEnumerable <string>)value; CheckedListBox.ObjectCollection items = ckListBox.Items; for (int ind = 0; ind < items.Count; ind++) { if (Finder.Find(checkedItems, (string)items[ind])) { ckListBox.SetItemChecked(ind, true); } } return(true); }
private void LoadGDOData(string dbName, CheckedListBox.ObjectCollection items) { foreach (var aLine in File.ReadAllLines(GetGDODataPath(dbName))) { if (string.IsNullOrWhiteSpace(aLine)) { continue; } var line = aLine.Trim(); if (line.StartsWith("#")) { continue; } items.Add(line); } }
/// <summary> /// Collect Changed Item List From CheckedListBox Control(Include Selected and Unselected) /// </summary> /// <param name="checkedListBoxItems"></param> /// <param name="selectedItemList"></param> /// <param name="unselectedItemList"></param> public static void CollectChangedItemList(CheckedListBox.ObjectCollection checkedListBoxItems, List <CheckedItem> selectedItemList, List <CheckedItem> unselectedItemList) { foreach (CheckedItem checkedItem in checkedListBoxItems) { if (checkedItem.IsChanged) { if (checkedItem.CurrentChecked) { selectedItemList.Add(checkedItem); } else { unselectedItemList.Add(checkedItem); } } } }
private void ItemChecked(object sender, ItemCheckEventArgs args) { if (!flag) { CheckedListBox.ObjectCollection items = this.FilmSizeList.Items; int index = args.Index; object obj2 = items[index]; if (args.NewValue == CheckState.Checked) { int num2 = _component.AvailableFilmSizes.Add(obj2); } else { _component.AvailableFilmSizes.Remove(obj2); } } }
public void loadFileList() { if (Directory.Exists(this.importPath)) { CheckedListBox.ObjectCollection items = chkFileList.Items; items.Clear(); IEnumerable <string> files = Directory.EnumerateFiles(this.importPath, "*.xml", SearchOption.TopDirectoryOnly); foreach (string fileName in files) { string[] fn = fileName.Split('\\'); string name = fn[fn.Length - 1]; items.Add(name); } } chkFileList.Refresh(); Console.Out.WriteLine("File List loaded"); }
SetTasksToRun ( AutomationTasks eTasksToRun ) { AssertValid(); CheckedListBox.ObjectCollection oItems = clbTasksToRun.Items; Int32 iItems = oItems.Count; m_bIgnoreItemCheckEvents = true; for (Int32 i = 0; i < iItems; i++) { clbTasksToRun.SetItemChecked(i, (eTasksToRun & ItemToAutomationTask(oItems[i])) != 0); } m_bIgnoreItemCheckEvents = false; }