void AddProperties(List <Property> properties) { foreach (Property p in properties) { var item = new CheckBoxItem() { ID = p.PropertyId, Display = p.Name, IsChecked = false }; switch (p.Type) { case Property.PropertyType.Style: Styles.Add(item); break; case Property.PropertyType.Neckline: Necklines.Add(item); break; case Property.PropertyType.Silhouette: Silhouettes.Add(item); break; } } }
private void FrmSetAdjustData_Load(object sender, EventArgs e) { layersPanel.Items.Clear(); for (int i = 0; i < m_mapCtl.Map.LayerCount; i++) { ILayer layer = m_mapCtl.Map.get_Layer(i); if (layer is IFeatureLayer) { CheckBoxItem chkItem = new CheckBoxItem(); chkItem.Text = layer.Name; layersPanel.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { chkItem }); if (m_listLayers == null) { continue; } for (int j = 0; j < m_listLayers.Count; j++) { if (layer.Name == m_listLayers[j]) { chkItem.Checked = true; } } } } }
private void ItemListBox_Levels_SelectedIndexChanged(object sender, EventArgs e) { bool enableListBox = false; var lvl = GetSelectedLevel(); ItemPanel_Areas.SuspendLayout(); ItemPanel_Areas.Items.Clear(); if (lvl is object) { foreach (LevelArea area in lvl.Areas) { var item = new CheckBoxItem() { Tag = area, Text = "Area " + Conversions.ToString(area.AreaID), Checked = true }; ItemPanel_Areas.Items.Add(item); } if (addAreasOnly) { enableListBox = true; } } ItemPanel_Areas.ResumeLayout(false); ItemPanel_Areas.Refresh(); ItemPanel_Areas.Enabled = enableListBox; }
public async Task <IActionResult> Edit(string id) { var user = await userManager.FindByIdAsync(id); if (user == null) { // ToDo: Implement notfound page return(View("NotFound")); } var vm = new EditUserViewModel { UserId = user.Id, Email = user.Email, UserName = user.UserName }; var roles = await roleManager.Roles.ToListAsync(); var userRoles = (await userManager.GetRolesAsync(user)); foreach (var role in roles) { var item = new CheckBoxItem(); item.Name = role.NormalizedName; if (userRoles.Any(c => c == role.Name)) { item.IsSelected = true; } vm.UserRoles.Add(item); } return(View(vm)); }
public IList <CheckBoxItem> GetCheckBoxItem() { var list = new List <CheckBoxItem>(); if (AllRoleList == null) { return(list); } foreach (var role in AllRoleList) { bool checkStatus = false; if (IsEdit) { checkStatus = UserRoleList.Contains(role); } CheckBoxItem item = new CheckBoxItem { Text = role.RoleName, Value = role.RoleId.ToString(), Checked = checkStatus }; list.Add(item); } return(list); }
/// <summary> /// 根据选择设置文本框内显示值 /// Created:20170410(ChengMengjia) /// </summary> /// <param name="list"></param> /// <param name="txtbox"></param> /// <param name="ckItem"></param> void ReSetMembers(Dictionary <string, string> list, TextBox txtbox, CheckBoxItem ckItem) { if (ckItem.Checked) { //选中 list.Add(ckItem.Tag.ToString(), ckItem.Text); } else { //取消选中 list.Remove(ckItem.Tag.ToString()); } string names = ""; string ids = ""; foreach (var d in list) { names += d.Value + ","; ids += d.Key + ","; } names = names.Length > 0 ? names.Substring(0, names.Length - 1) : names; ids = ids.Length > 0 ? ids.Substring(0, ids.Length - 1) : ids; txtbox.Text = names; txtbox.Tag = ids; }
/// <summary> /// This creates a list of all check boxes /// </summary> /// <param name="allMenuPaths"></param> /// <returns></returns> private static List <CheckBoxItem> createAllCheckBoxes(List <MenuPathMain> allMenuPaths) { List <CheckBoxItem> checkedboxes = new List <CheckBoxItem>(); if (!allMenuPaths.IsNullOrEmpty()) { foreach (var menupath in allMenuPaths) { string name1 = "", name2 = "", name3 = ""; if (!menupath.MenuPath1.IsNull()) { name1 = menupath.MenuPath1.Name; } if (!menupath.MenuPath2.IsNull()) { name2 = menupath.MenuPath2.Name; } if (!menupath.MenuPath3.IsNull()) { name3 = menupath.MenuPath3.Name; } CheckBoxItem chk = new CheckBoxItem(menupath.Id, menupath.Name, name1, name2, name3, true); checkedboxes.Add(chk); } } return(checkedboxes); }
/// <summary> /// Initializes all data members. Allows to set parent question and copy data from another choice item. /// </summary> /// <param name="old"><see cref="CheckBoxItem"/> instance that constructor takes data from.</param> /// <param name="parent"><see cref="MultipleChoiceQuestion"/> instance that item belongs to.</param> public CheckBoxItem(CheckBoxItem old, Question parent) { Parent = parent; IsChecked = old.IsChecked; _isMoreDetails = old._isMoreDetails; Name = old.Name; MoreDetails = string.Empty; }
public override object Deserialize(Cell _data, ConversionContext _context = null) { object data = base.Deserialize(_data); CheckBoxList chkList; if (data == null) { chkList = new CheckBoxList(); } else { chkList = data as CheckBoxList; } if (_context == null || _context.Field == null || _context.Field.Metadata == null) { return(chkList); } if (!_context.Field.Metadata.IsLoaded) { _context.Field.Metadata.Load(); } var metadata = _context.Field.Metadata.FirstOrDefault(m => m.Key == ModuleRepository.CheckBoxListMetadataKey); if (metadata != null && !String.IsNullOrWhiteSpace(metadata.Value)) { var json = new JavaScriptSerializer(); var items = json.Deserialize <string[]>(metadata.Value); if (items != null) { foreach (var i in items) { // avoid adding empty entries to the dictionary if (!String.IsNullOrWhiteSpace(i)) { var newItem = new CheckBoxItem { Key = i.EscapeName(), Value = i }; // checked options will already be present in the list if (!chkList.Any(it => it.Value == i)) { chkList.Add(newItem); } } } } } return(chkList); }
private void viewCheckboxes_CheckedChanging(object sender, CheckBoxChangeEventArgs e) { CheckBoxItem checkBox = (CheckBoxItem)sender; if (!usingMouse && checkBox.Checked && (ApplicationSettings.editedTypes & (ItemTypes)checkBox.Tag) == (ItemTypes)checkBox.Tag) { e.Cancel = true; } }
private async Task ItemSelected(CheckBoxItem parm) { parm.IsSelected = !parm.IsSelected; await Task.FromResult(true); ///await Shell.Current.Navigation.PopModalAsync(); //await Shell.Current.Navigation.PushAsync(new EditProjectLocationImage() //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } }); }
/// <summary> /// Initialise our CheckBoxColumn. /// </summary> public CheckBoxColumn() { // set the view one as readonly viewItem = new CheckBoxItem(false); // SAW was false this.ItemTemplate = viewItem as ITemplate; // let the edit check box be editable editItem = new CheckBoxItem(true); this.EditItemTemplate = editItem as ITemplate; }
public CheckBoxX() { this.SetStyle(ControlStyles.Selectable, true); m_CheckBox = new CheckBoxItem(); m_CheckBox.VerticalPadding = 0; m_CheckBox.Style = eDotNetBarStyle.Office2007; m_CheckBox.CheckedChanging += new CheckBoxChangeEventHandler(OnCheckedChanging); m_CheckBox.CheckedChanged += new CheckBoxChangeEventHandler(OnCheckedChanged); this.HostItem = m_CheckBox; }
/// <summary> /// Initialise our CheckBoxColumn with an optional ImmediatePostback capability. /// </summary> /// <param name="ImmediatePostback">If true then each change of state of the CheckBox item /// will cause an event to be fired immediately on the server.</param> public CheckBoxColumn(bool ImmediatePostback) { // set the view one as readonly viewItem = new CheckBoxItem(ImmediatePostback); this.ItemTemplate = viewItem as ITemplate; // let the edit check box be editable editItem = new CheckBoxItem(true); this.EditItemTemplate = editItem as ITemplate; AutoPostBack = ImmediatePostback; }
/// <summary> /// Constructor /// </summary> public GlossyCustomItem() { // Lets add a simple CheckBox to our item _CheckBox = new CheckBoxItem(); _CheckBox.Text = "Color"; _CheckBox.TextColor = Color.White; SubItems.Add(_CheckBox); // Hook our events HookEvents(true); }
void item_CheckedChanged(object sender, CheckBoxChangeEventArgs e) { List <string> displays = new List <string>(); foreach (BaseItem item in btnShowItems.SubItems) { CheckBoxItem citem = (CheckBoxItem)item; if (citem.Checked) { displays.Add(citem.Text); } _showItems[item.Text] = citem.Checked; } _helper.ResetDisplayColumn(displays); }
/// <summary> /// Gets a check box list of groups for a city. Used for the user models /// </summary> public List <CheckBoxItem> GetGroups(PemsCity currentCity) { var secMgr = new SecurityManager(); var cityGroups = secMgr.GetGroups(currentCity); var checkBoxList = new List <CheckBoxItem>(); //Add data in SelectList List foreach (var item in cityGroups) { var chk = new CheckBoxItem { Text = item.Key, Selected = false, Value = item.Key }; checkBoxList.Add(chk); } return(checkBoxList); }
/// <summary> /// 周报内容勾选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ckItem_CheckedChanged(object sender, CheckBoxChangeEventArgs e) { Setting setting = bll.GetSetting(ProjectId); CheckBoxItem item = (CheckBoxItem)sender; int index = int.Parse(item.Tag.ToString()) - 1; listContent[index] = item.Checked ? "1" : "0"; string result = ""; for (int i = 0; i < 8; i++) { result += listContent[i] + ","; } setting.WeeklyCheck = result; bll.SaveSetting(setting); }
public void AddDrawItem(IDrawItem item) { _itemsToDraw.Add(item); var cb = new CheckBoxItem(item.SettingName()); _itemsShouldDraw.Add(item.SettingName(), false); cb.Tag = item.SettingName(); cb.Text = item.CheckBoxName(); if (pIniManager.GetBoolean("Radar", item.SettingName(), false)) { cb.Checked = true; _itemsShouldDraw[item.SettingName()] = true; } cb.Click += DrawItemClick; ControlSettings.Items.Add(cb); }
private void OnTagClicked(object sender, EventArgs e) { CheckBoxItem pItem = ((CheckBoxItem)sender); if (pItem != null) { if (pItem.IsItemChecked()) { AddTag(pItem.GetText()); } else { RemoveTag(pItem.GetText()); } } }
// GET: Chat/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var chat = await _context.Chats.FindAsync(id); if (chat == null) { return(NotFound()); } var conferenceVersion = await _context.ConferenceVersions.Where(x => x.Id == chat.ConferenceVersionId).FirstOrDefaultAsync(); var rooms = await _context.Rooms.Where(x => x.EventCentreId == conferenceVersion.EventCentreId).ToListAsync(); this.ViewData["Rooms"] = new SelectList(rooms, "Id", "Name"); var tags = await _context.Tags.ToListAsync(); var availableTags = new List <CheckBoxItem>(); foreach (var tag in tags) { var eventTag = await _context.EventTags.FirstOrDefaultAsync(x => x.EventId == chat.Id && x.TagId == tag.Id); var checkBox = new CheckBoxItem() { TagId = tag.Id, Title = tag.Name, IsChecked = eventTag != null }; availableTags.Add(checkBox); } var users = await _context.Users.ToListAsync(); var userList = new List <object>(); foreach (var user in users) { userList.Add(user); } ViewBag.Moderators = new SelectList(userList, "Id", "Email"); this.ViewData["AvailableTags"] = availableTags; return(View(chat)); }
/// <summary> /// This method loads the child products into the checklist for display in the Sale message /// </summary> /// <param name="childProductsBelongingToUserFrom"></param> /// <returns></returns> private ICollection <CheckBoxItem> loadChildProductsIntoCheckItems(HashSet <ProductChild> childProductsBelongingToUserFrom) { List <CheckBoxItem> lst = new List <CheckBoxItem>(); if (childProductsBelongingToUserFrom.IsNullOrEmpty()) { return(lst); } foreach (ProductChild productChild in childProductsBelongingToUserFrom) { CheckBoxItem chkBx = new CheckBoxItem(productChild); lst.Add(chkBx); } return(lst); }
public void initTree() { var brands = CodeCache.getBrand().Where(c => c.parentId == classId); foreach (var brand in brands) { DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(); node.Text = brand.id.ToString(); CheckBoxItem cbi = new CheckBoxItem() { Text = brand.codeName }; cbi.CheckedChanged += Cbi_CheckedChanged; if (selectedDic.ContainsKey(brand.id)) { cbi.Checked = true; } node.HostedItem = cbi; var models = CodeCache.getModel().Where(c => c.parentId == brand.id); if (models.Count() == 0) { cbi.Enabled = false; } tree.Nodes.Add(node); foreach (var model in models) { DevComponents.AdvTree.Node subNode = new DevComponents.AdvTree.Node(); subNode.Text = model.id.ToString(); CheckBoxItem subCbi = new CheckBoxItem() { Text = model.codeName }; if (selectedDic.ContainsKey(brand.id)) { if (selectedDic[brand.id].Contains(model.id)) { subCbi.Checked = true; } } subNode.HostedItem = subCbi; node.Nodes.Add(subNode); } } tree.ExpandAll(); }
/// <summary> /// This marks the check boxes that have been selected in the product true. /// </summary> /// <param name="iproduct"></param> /// <param name="checkedboxes"></param> private static void markProductSelectedCheckBoxesTrue(IProduct iproduct, List <CheckBoxItem> checkedboxes) { //Here we are going to get the marked menupaths if (!iproduct.MenuPathMains.IsNullOrEmpty()) { //Now mark all the ones contained in this product as true //Now initialize the values in the check boxes foreach (var menuPaths in iproduct.MenuPathMains) { CheckBoxItem cbi = checkedboxes.FirstOrDefault(x => x.Id == menuPaths.Id); if (cbi.IsNull()) { continue; } cbi.IsTrue = true; } } }
private void LoadSortingLine(TaskInfoList taskInfoList) { itemPanel1.Items.Clear(); itemPanel1.BeginUpdate(); foreach (TaskInfo taskInfo in taskInfoList) { if (!taskInfo.LineName.Contains("罚没") && taskInfo.LineCode == AppUtil._SortingLineId) { CheckBoxItem checkBoxX = new CheckBoxItem(); checkBoxX.Text = taskInfo.LineName + "-任务号" + taskInfo.TaskNo; checkBoxX.Name = taskInfo.LineCode + taskInfo.TaskNo; checkBoxX.Tag = taskInfo; checkBoxX.Checked = true; itemPanel1.Items.Add(checkBoxX); } } itemPanel1.EndUpdate(true); }
protected override void OnBackgroundWorkerCompleted(object result) { //因為這是第二個執行緒的 Callback,很可能使用者操作很快,所以在沒有執行這此時,畫面就被關了,不檢查可能會造成錯誤! if (IsDisposed) { return; } _valueManager.AddValue("IsDirty", false.ToString()); IDataProvider provider = result as IDataProvider; _helper = new DataGridViewHelper(dataGridView1, provider); _helper.DirtyChanged += new EventHandler <DirtyChangedEventArgs>(_helper_DirtyChanged); _helper.Fill(); if (_showItems == null) { _showItems = new Dictionary <string, bool>(); foreach (DataGridViewColumn column in dataGridView1.Columns) { _showItems.Add(column.Name, true); } } // 設定顯示項目 btnShowItems.SubItems.Clear(); btnShowItems.AutoExpandOnClick = true; List <string> displayItem = new List <string>(); foreach (DataGridViewColumn column in dataGridView1.Columns) { bool visible = _showItems[column.Name]; CheckBoxItem item = new CheckBoxItem(column.Name, column.Name); btnShowItems.SubItems.Add(item); item.AutoCollapseOnClick = false; item.Checked = visible; item.CheckedChanged += new CheckBoxChangeEventHandler(item_CheckedChanged); if (visible) { displayItem.Add(column.Name); } } _helper.ResetDisplayColumn(displayItem); }
public IActionResult Choose(int id) { var scheduleEntry = _db.ScheduleEntry.Where(se => se.Id == id).Include(sr => sr.ScreeningRoom).FirstOrDefault(); if (scheduleEntry == null) { return(NotFound()); } List <Seat> seats = _db.Seat.Where(s => s.IdScreeningRoom == scheduleEntry.ScreeningRoom.Id).ToList(); List <List <CheckBoxItem> > seatCheckBoxList = new List <List <CheckBoxItem> >(); for (int i = 0; i < scheduleEntry.ScreeningRoom.NumberOfRows; i++) { List <CheckBoxItem> tempList = new List <CheckBoxItem>(); for (int j = 0; j < scheduleEntry.ScreeningRoom.NumberOfSeatsPerRow; j++) { CheckBoxItem seatCheckBox = new CheckBoxItem() { Id = seats[j + i * scheduleEntry.ScreeningRoom.NumberOfSeatsPerRow].Id, Object = seats[j + i * scheduleEntry.ScreeningRoom.NumberOfSeatsPerRow], IsChecked = false }; tempList.Add(seatCheckBox); } seatCheckBoxList.Add(tempList); } List <Seat> reservedSeat = _db.Reservation.Where(r => r.IdScheduleEntry == id).Include(s => s.Seat).Select(s => s.Seat).ToList(); foreach (var seat in reservedSeat) { seatCheckBoxList[seat.RowNumber][seat.SeatNumber].IsChecked = true; } ChooseSeatVM chooseSeatVM = new ChooseSeatVM() { ScheduleEntryId = id, SeatCheckBoxList = seatCheckBoxList }; return(View(chooseSeatVM)); }
private void buttonX1_Click(object sender, EventArgs e) // 确定 { ret = 0; uint r = 0x80000000; for (int i = 0; i < ItemContainers.Length; i++) { for (int j = 0; j < ItemContainers[i].SubItems.Count; j++) { CheckBoxItem checkbox = (CheckBoxItem)ItemContainers[i].SubItems[j]; if (checkbox.Checked) { ret += r; } r >>= 1; } } DialogResult = DialogResult.OK; this.Close(); }
public IList <CheckBoxItem> GetCheckBoxItem(IList <Menu> menuList) { var list = new List <CheckBoxItem>(); foreach (var menu in menuList) { bool checkStatus = false; if (IsEdit) { checkStatus = RoleMenus.Contains(menu); } CheckBoxItem item = new CheckBoxItem { Text = menu.MenuName, Value = menu.MenuId.ToString(), Checked = checkStatus }; list.Add(item); } return(list); }
private void setGroupText() { this.chkLstArea.Clear(); DataTable pathAlarmChecked = RemotingClient.GetPathAlarmChecked(base.sCarId); if ((pathAlarmChecked != null) && (pathAlarmChecked.Rows.Count > 0)) { DataRow[] rowArray = pathAlarmChecked.Select(); int length = rowArray.Length; if ((pathAlarmChecked != null) && (length > 0)) { foreach (DataRow row in rowArray) { CheckBoxItem chk = new CheckBoxItem { Text = row["pathname"].ToString(), Name = row["newpathid"].ToString() }; this.chkLstArea.Add(chk); } } } }
private void setGroupText() { this.chkLstArea.Clear(); if (base.OrderCode == CmdParam.OrderCode.取消报警区域值) { DataTable table = RemotingClient.Car_GetRegionInfo(base.sCarId, this.iRegionFeature); if ((table != null) && (table.Rows.Count > 0)) { foreach (DataRow row in table.Rows) { if (!string.IsNullOrEmpty(row["NewRegionId"].ToString()) && !"0".Equals(row["NewRegionId"].ToString())) { CheckBoxItem chk = new CheckBoxItem { Text = row["RegionName"].ToString(), Name = row["NewRegionId"].ToString() }; this.chkLstArea.Add(chk); } } } this.chkLstArea.Enabled = this.cbxExpandRegion.Checked; } }
protected virtual Office2007CheckBoxColorTable GetColorTable(CheckBoxItem item, System.Windows.Forms.Control container) { if (container == null) return m_ColorTable.CheckBoxItem; Office2007ColorTable table = m_ColorTable; string key = Office2007ColorTable.GetContextualKey(typeof(Office2007CheckBoxColorTable), container.GetType()); object st = null; if (container is Bar) { if (table.ContextualTables.TryGetValue(key + "+" + ((Bar)container).BarType.ToString(), out st)) return (Office2007CheckBoxColorTable)st; } if (table.ContextualTables.TryGetValue(key, out st)) return (Office2007CheckBoxColorTable)st; return m_ColorTable.CheckBoxItem; }