public GroupEntity( XmlNode node, DeviceEntity parent) : this(parent) { #region 从Xml节点属性中获取属性值 if (node.Attributes["Name"] != null) { name = node.Attributes["Name"].Value; } #endregion XmlNode childNode = node.FirstChild; while (childNode != null) { if (childNode.Name == "Tag") { TagEntity tag = new TagEntity(childNode, this); Tags.Add(tag); } else if (childNode.Name == "SubTagGroup") { SubGroupEntity subGroup = new SubGroupEntity(childNode, this); SubGroups.Add(subGroup); } childNode = childNode.NextSibling; } }
private void ShowSubGroupSuggestions(List <GroupVideoQualityVM> vidQualList) { SubGroups.Clear(); Dictionary <string, GroupVideoQualityVM> vidQuals = new Dictionary <string, GroupVideoQualityVM>(); foreach (GroupVideoQualityVM vidQual in vidQualList) { vidQuals[vidQual.GroupNameShort] = vidQual; } foreach (GroupVideoQualityVM vidq in vidQuals.Values) { if (vidq.GroupNameShort != "NO GROUP INFO") { SubGroupSimple sub = new SubGroupSimple(); sub.GroupName = vidq.GroupName; sub.GroupNameShort = vidq.GroupNameShort; SubGroups.Add(sub); } } }
private void addGroupSubFilter(a7FilterGroupEditor fge, bool fromRemove) { fge.Parent = this; FltGroupExprData fgeExpr = null; if (this.Filter is FltGroupExprData) { fgeExpr = this.Filter as FltGroupExprData; } else { if (JoinType.HasValue) { fgeExpr = new FltGroupExprData(JoinType.Value); } else { fgeExpr = new FltGroupExprData(); } if (Parent != null && Parent.Filter != null) { var parentGroup = Parent.Filter as FltGroupExprData; parentGroup.FilterExpressions.Remove(this.Filter); parentGroup.FilterExpressions.Add(fgeExpr); } this.Filter = fgeExpr; } fgeExpr.FilterExpressions.Add(fge.Filter); if (this.SubGroups.Count > 0 || this.AtomFilter != null) { bAdd.Visibility = Visibility.Visible; bAnd.Visibility = Visibility.Collapsed; bOr.Visibility = Visibility.Collapsed; } else { SetBackground(fge.MyBackgroundIndex + a7SqlTools.Controls.Filter.a7FilterEditor.BackgroundIndexStep); bAdd.Visibility = Visibility.Collapsed; bAnd.Visibility = Visibility.Visible; bOr.Visibility = Visibility.Visible; } if (JoinType.HasValue) { if (JoinType.Value == eAndOrJoin.And) { miChangeToOr.Visibility = System.Windows.Visibility.Visible; miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed; } else { miChangeToOr.Visibility = System.Windows.Visibility.Collapsed; miChangeToAnd.Visibility = System.Windows.Visibility.Visible; } } else { miChangeToOr.Visibility = System.Windows.Visibility.Collapsed; miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed; } if (!fromRemove && (AddedFirstElement != null && this.Parent == null)) { this.AddedFirstElement(this, null); } if (AtomFilter != null) //replacing existing atomfilter with groupfilter containing the atomfilter { var newFge = new a7FilterGroupEditor(_entity, !_vertical, this.IsReadOnly, EditorContext, AtomFilter.Filter); fgeExpr.FilterExpressions.Add(AtomFilter.Filter); newFge.Parent = this; ccAtom.Content = null; newFge.SetAtomFilter(AtomFilter); AtomFilter = null; this.Negate(false); spSubGroups.Children.Add(newFge); SubGroups.Add(newFge); } if (SubGroups.Count > 0 && JoinType.HasValue) { var andOrLabel = new Label() { Content = (JoinType.Value == eAndOrJoin.And) ? "And": "Or", VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; spSubGroups.Children.Add(andOrLabel); fge.JoinLabelOnParent = andOrLabel; fgeExpr.AndOr = JoinType.Value; } SubGroups.Add(fge); spSubGroups.Children.Add(fge); fge.AtomFilter?.FocusControl(); }