private void treeViewDoc_AfterSelect(object sender, TreeViewEventArgs e) { this.CurrentView = e?.Node?.Tag as FilteredView <DataItemBase>; this.UpdateDocDisplay(); this.UpdateTagButtonStatus(); if (this.CurrentView == null) { this.closeToolStripMenuItem.Enabled = false; this.filterToolStripMenuItemDoc.Enabled = false; this.Text = Product.GetTitle(); this.progressBarMain.Visible = false; this.toolStripComboBoxString.Enabled = false; return; } this.Text = $"{Product.GetTitle()} - {this.CurrentView.Name}"; this.closeToolStripMenuItem.Enabled = true; this.filterToolStripMenuItemDoc.Enabled = true; this.toolStripComboBoxString.Enabled = true; if (this.CurrentView.LastCountResult.HasValue) { this.toolStripLabelCount.Text = this.CurrentView.LastCountResult.Value.ToString(); } }
private void RemoveView(IFilteredView <DataItemBase> view) { if (view == null) { return; } var disposable = view as IDisposable; disposable?.Dispose(); }
private void AddView(IFilteredView <DataItemBase> childView, TreeNode parentNode = null, bool activate = true) { TreeNode node; if (parentNode == null) { node = this.treeViewDoc.Nodes.Add(childView.Name, childView.Name); } else { node = parentNode.Nodes.Add(childView.Name, childView.Name); } node.Tag = childView; if (activate) { this.treeViewDoc.SelectedNode = node; } if (childView.GroupFilters != null) { var defaultFilters = node.Nodes.Add("Default Filters", "Default Filters"); defaultFilters.Tag = childView; foreach (var v in childView.GroupFilters.Select(childView.CreateChild).ToList()) { this.AddView(v, defaultFilters, false); } } if (!node.IsExpanded) { node.Expand(); } }