/// <summary> /// returns all changed /// </summary> /// <returns></returns> private List <BrandMetadataSetting> GetInputSettings() { var result = new List <BrandMetadataSetting>(); foreach (var selected in Selection) { //retrieve if this group had a different selection before var prevSelection = SelectableSettings.FirstOrDefault(s => s.SelectableSetting.FilterGroup == selected.Key); if (prevSelection != null && prevSelection.SelectableSetting.BrandMetadataSelectableSettingId != selected.Value) {//remove selection from a previously selected setting that is now changing and no longer selected prevSelection.SelectableSetting.FilterGroup = 0; result.Add(prevSelection); } if (selected.Value > 0) { //selected - apply selection var newSelected = SelectableSettings.FirstOrDefault(s => s.SelectableSetting.BrandMetadataSelectableSettingId == selected.Value); newSelected.SelectableSetting.FilterGroup = selected.Key; if (GroupSelectableTypeChanges.ContainsKey(selected.Key)) { newSelected.SelectableSetting.FilterSelectableType = GroupSelectableTypeChanges[selected.Key]; } if (GroupSelectableRowsCountChanges.ContainsKey(SelectedGroup)) { newSelected.SelectableSetting.FilterDepth = GroupSelectableRowsCountChanges[SelectedGroup]; } result.Add(newSelected); } } return(result); }
private void LoadPreviewState() { if (GroupSelectableTypeChanges.ContainsKey(SelectedGroup)) {//apply the previously saved selection for the group //filter selectable type in case we have such i.e. if a group is selected //AND it's selectable type was changed var selection = (SelectableMetadataType)GroupSelectableTypeChanges[SelectedGroup]; Option1RadioButton.Checked = selection == SelectableMetadataType.DropDown; Option2RadioButton.Checked = selection == SelectableMetadataType.ComboBox; } if (GroupSelectableRowsCountChanges.ContainsKey(SelectedGroup)) { RowsDropDownList.SelectedValue = GroupSelectableRowsCountChanges[SelectedGroup].ToString(); } var brandMetaSetting = GetSelectedMetaSetting(); if (brandMetaSetting != null && GroupDetailsPanel.Visible) { LoadMetaPreview(PreviewMetaInputDropDown, brandMetaSetting, 1, SelectableMetadataType.DropDown); LoadMetaPreview(PreviewMetaInputList, brandMetaSetting, int.Parse(RowsDropDownList.SelectedValue), SelectableMetadataType.ComboBox); } }