public CheckBoxListItem add() { CheckBoxListItem item = new CheckBoxListItem(Items.Count); item.CheckedChanged += item_CheckedChanged; return(addItem(item)); }
public CheckBoxListItem add(string name, object userData) { CheckBoxListItem item = new CheckBoxListItem(Items.Count, name, userData); item.CheckedChanged += item_CheckedChanged; return(addItem(item)); }
private CheckBoxListItem addItem(CheckBoxListItem item) { tableLayout.RowStyles.Clear(); tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableLayout.Controls.Add(item, 0, tableLayout.RowCount++); Items.Add(item); return(item); }
/// <summary> /// Render locations /// </summary> /// <param name="locations"></param> /// <param name="defaultLocation"></param> /// <returns></returns> List <int> updateLocations(List <Location> locations, Location defaultLocation = null) { locationsList.clear(); //locationsList.Contr // Check for setting the default location //bool checkForDedault = (LoginServer.defaultLocation != null) & (Program.config.locations.Count == 0); bool checkForDedault = (defaultLocation != null) & (Program.config.locations.Count == 0); List <int> locs = new List <int>(); foreach (Location loc in locations) { CheckBoxListItem item = locationsList.add(loc.name, loc); if (checkForDedault) { if (defaultLocation.id == loc.id) { item.Selected = true; if (!locs.Exists(i => i == loc.id)) { locs.Add(loc.id); } } } foreach (int id in Program.config.locations) { if (id == loc.id) { item.Selected = true; if (!locs.Exists(i => i == loc.id)) { locs.Add(loc.id); } } } } return(locs); }