public static ContentsRequest FindAssociations(object target, ContentsRequest request) { switch (request.Type) { case EVisualClass.SpecialAdvanced: case EVisualClass.SpecialMeta: case EVisualClass.SpecialAll: case EVisualClass.SpecialStatistic: IEnumerable <Column> cols = ColumnManager.GetColumns(request.Core, target).OrderBy(z => z.Special.Has(EColumn.Visible)); bool shortName; switch (request.Type) { case EVisualClass.SpecialAll: request.Text = "All data fields for {0}"; cols = cols.Where(z => !z.Special.Has(EColumn.Advanced)); shortName = false; break; case EVisualClass.SpecialStatistic: request.Text = "Statistics fields for {0}"; cols = cols.Where(z => !z.Special.Has(EColumn.Advanced) && z.Special.Has(EColumn.IsStatistic)); shortName = true; break; case EVisualClass.SpecialMeta: request.Text = "Meta-data fields for {0}"; cols = cols.Where(z => !z.Special.Has(EColumn.Advanced) && z.Special.Has(EColumn.IsMeta)); shortName = true; break; default: case EVisualClass.SpecialAdvanced: request.Text = "Internal data for {0}"; shortName = false; break; } foreach (var c in cols) { request.Add(new ColumnValuePair(c, target, ColumnManager.GetColumnColour(c), Resources.ListIconInformation, shortName)); } break; default: if (target is Associational) { ((Associational)target).OnFindAssociations(request); } break; } return(request); }
private void RefreshView( ) { this.treeView1.Nodes.Clear(); bool hideAdva = IsHidden(_chkAdvanced); bool hideMeta = IsHidden(_chkMetaFields); bool hideProp = IsHidden(_chkProperties); bool hideStat = IsHidden(_chkStatistics); bool hideDefa = IsHidden(_chkDefault); bool hideNorm = IsHidden(_chkNormal); bool hideFold = IsHidden(_chkFolders); foreach (Column col in this._available) { bool isSelected = this._selected.Contains(col); if (!isSelected) { if (col.Special.Has(EColumn.IsMeta)) { if (hideMeta) { continue; } } else if (col.Special.Has(EColumn.IsProperty)) { if (hideProp) { continue; } } else if (col.Special.Has(EColumn.IsStatistic)) { if (hideStat) { continue; } } else if (col.Special.Has(EColumn.Visible)) { if (hideDefa) { continue; } } else if (col.Special.Has(EColumn.Advanced)) { if (hideAdva) { continue; } } else if (hideNorm) { continue; } } TreeNodeCollection parent = this.treeView1.Nodes; string text; if (hideFold) { string dir = UiControls.GetDirectory(col.Id); if (!string.IsNullOrEmpty(dir)) { dir += "\\"; } text = dir + col.DisplayName; } else { string[] elements = col.Id.Split('\\'); for (int n = 0; n < elements.Length - 1; n++) { bool found = false; foreach (TreeNode child in parent) { if (child.Text == elements[n]) { parent = child.Nodes; found = true; break; } } if (!found) { TreeNode newNode = new TreeNode(elements[n]); newNode.NodeFont = FontHelper.ItalicFont; newNode.ForeColor = ColumnManager.COLCOL_FOLDER; parent.Add(newNode); parent = newNode.Nodes; } } text = col.DisplayName; } TreeNode node = new TreeNode(text); node.Tag = col; node.Checked = isSelected; node.ForeColor = ColumnManager.GetColumnColour(col); parent.Add(node); } this.treeView1.ExpandAll(); }