/// <summary> /// Helper method that creates a window that displays an alternative view of the /// MasterGraph using a separate FoldingManager and therefor a separate set of /// dummy items. /// </summary> /// <remarks> /// This allows for using different visualizations of the folding edges and collapsed group nodes. /// </remarks> /// <param name="foldingEdgeConverter">The edge converter to use</param> private void ShowAdditionalManager(IFoldingEdgeConverter foldingEdgeConverter) { // create the GraphControl GraphControl graphControl = new GraphControl(); // create a new manager for the same master graph. FoldingManager manager = new FoldingManager(foldingManager.MasterGraph); // assign the provided converter manager.FoldingEdgeConverter = foldingEdgeConverter; // create a view IFoldingView foldingView = manager.CreateFoldingView(); // make the view disappear once it becomes invalid foldingView.AutoSwitchToAncestor = false; // set the graph graphControl.Graph = foldingView.Graph; // and edit mode graphControl.InputMode = CreateEditorMode(); // share the clipboard with the rest of the windows graphControl.Clipboard = this.graphControl.Clipboard; // create the form Form form = new Form(); graphControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; form.Size = new Size(300, 300); graphControl.Location = new Point(0, 0); graphControl.Size = form.Size; form.Text = "Separate FoldingManager using " + foldingEdgeConverter; form.SuspendLayout(); form.Controls.Add(graphControl); form.ResumeLayout(); form.Visible = true; form.Owner = this; // fit the bounds graphControl.FitGraphBounds(); // setup delegate to dispose the window once the view becomes invalid foldingView.PropertyChanged += delegate(object _sender, PropertyChangedEventArgs _e) { if (_e.PropertyName == "Invalid" && foldingView.Invalid) { manager.Dispose(); form.Close(); form.Dispose(); } }; }
/// <summary> /// Helper method that creates a window that displays an alternative view of the /// MasterGraph using a separate FoldingManager and therefore a separate set of /// dummy items. /// </summary> /// <remarks> /// This allows for using different visualizations of the folding edges and collapsed group nodes. /// </remarks> /// <param name="foldingEdgeConverter">The edge converter to use</param> private void ShowAdditionalManager(IFoldingEdgeConverter foldingEdgeConverter) { // create the window Window window = new Window(); window.Title = "Separate FoldingManager using " + foldingEdgeConverter; // create the GraphControl GraphControl graphControl = new GraphControl(); // create a new manager for the same master graph. FoldingManager manager = new FoldingManager(foldingManager.MasterGraph); // assign the provided converter manager.FoldingEdgeConverter = foldingEdgeConverter; // create a view IFoldingView foldingView = manager.CreateFoldingView(); // make the view disappear once it becomes invalid foldingView.AutoSwitchToAncestor = false; // set the graph graphControl.Graph = foldingView.Graph; // and edit mode graphControl.InputMode = CreateEditorMode(); // share the clipboard with the rest of the windows graphControl.Clipboard = this.graphControl.Clipboard; // show the window window.Content = graphControl; window.Width = window.Height = 300; window.Owner = this; window.Show(); // fit the bounds graphControl.FitGraphBounds(); // setup delegate to dispose the window once the view becomes invalid foldingView.PropertyChanged += delegate(object _sender, PropertyChangedEventArgs _e) { if (_e.PropertyName == "Invalid" && foldingView.Invalid) { manager.Dispose(); window.Close(); } }; }