private void AddItem(DomainFilter Filter) { var Item = new FilterListItem(Filter); Item.PropertyChanged += Item_PropertyChanged; FilterList.Add(Item); }
private void AddParametrics(FilterListItem filterItem) { var id = int.Parse(filterItem.Id); var pi = dictionary.ParametricInfo(id, StormContext.CultureCode); var type = MapParametricType(pi); var filter = new FilterModel(id, type, pi.ValueType, pi.Name, pi.Description, pi.Uom); filters.Add(filter); foreach (FilterItem item in filterItem.Items) { var pid = int.Parse(item.Id); var pv = dictionary.ParametricValue(pi.Type, pid, StormContext.CultureCode); var value = new FilterValueModel <int> { Id = pv.Id, Value = pv.Id, Name = pv.Name, Description = pv.Description, Code = pv.Code, SortOrder = pv.SortOrder, ImageUrl = GetImageUrl(pv.ImageKey), Count = item.Count }; filter.Values.Add(value); } }
private void AddFilterList_SelectionChangeCommitted(object sender, EventArgs e) { // Add the selected filter item to the filter stack ComboBox box = sender as ComboBox; FilterListItem item = (FilterListItem)box.SelectedItem; box.Text = "Select a filter"; filterStackItems.Add(item); }
private void MoveFilterDown_Click(object sender, EventArgs e) { if (FilterStack.SelectedIndex >= 0 && FilterStack.SelectedIndex < filterStackItems.Count - 1) { // Move the item up an index FilterListItem item = filterStackItems[FilterStack.SelectedIndex]; int originalSelectedIndex = FilterStack.SelectedIndex; // preserve the selected index filterStackItems.RemoveAt(originalSelectedIndex); filterStackItems.Insert(originalSelectedIndex + 1, item); FilterStack.SelectedIndex = originalSelectedIndex + 1; // restore the selected index } }