private void UnregisterControl(DiagramDocument circuitNode, Control control) { //it's OK if the CircuitEditingContext was already removed or wasn't added to IContextRegistry. _contextRegistry.RemoveContext(circuitNode.As <DiagramEditingContext>()); _hostService.UnregisterControl(control); control.Visible = false; control.Dispose(); _controls.Remove(circuitNode); }
private void UnregisterControl(DiagramDocument circuitNode, Control control) { //it's OK if the CircuitEditingContext was already removed or wasn't added to IContextRegistry. _contextRegistry.RemoveContext(circuitNode.As<DiagramEditingContext>()); _hostService.UnregisterControl(control); control.Visible = false; control.Dispose(); _controls.Remove(circuitNode); }
public IDocument Open(Uri uri) { var underlyingDoc = _exportProvider.GetExport <NodeEditorCore.IDiagramDocument>().Value; underlyingDoc.ViewModel = new HyperGraph.GraphModel(); underlyingDoc.ViewModel.CompatibilityStrategy = _nodeFactory.CreateCompatibilityStrategy(); underlyingDoc.GraphContext = new ShaderPatcherLayer.NodeGraphContext(); // When creating a new document, we'll pass through here with a file that // doesn't exist... So let's check if we need to load it now... if (File.Exists(uri.LocalPath)) { underlyingDoc.Load(uri); } underlyingDoc.GraphContext.DefaultsMaterial = _activeMaterialContext.MaterialName; underlyingDoc.GraphContext.PreviewModelFile = "game/model/galleon/galleon.dae"; var doc = new DiagramDocument(underlyingDoc, uri) { NodeFactory = _nodeFactory }; var control = _exportProvider.GetExport <Controls.IDiagramControl>().Value; control.SetContext(doc); // Create a control for the new document, and register it! _controlRegistry.RegisterControl( doc, control.As <Control>(), new ControlInfo(Path.GetFileName(uri.LocalPath), uri.LocalPath, StandardControlGroup.Center) { IsDocument = true }, this); return(doc); }
public ControlInfo GetControlInfo(DiagramDocument domNode) { return((from ctrol in _controls where ctrol.Key == domNode select ctrol.Value.Second).FirstOrDefault()); }
public virtual void RegisterControl(DiagramDocument doc, Control control, ControlInfo controlInfo, IControlHostClient client) { _controls.Add(doc, new Pair <Control, ControlInfo>(control, controlInfo)); _hostService.RegisterControl(control, controlInfo, client); }
public IDocument Open(Uri uri) { var underlyingDoc = _exportProvider.GetExport<NodeEditorCore.IDiagramDocument>().Value; underlyingDoc.ViewModel = new HyperGraph.GraphModel(); underlyingDoc.ViewModel.CompatibilityStrategy = _nodeFactory.CreateCompatibilityStrategy(); underlyingDoc.GraphContext = new ShaderPatcherLayer.NodeGraphContext(); // When creating a new document, we'll pass through here with a file that // doesn't exist... So let's check if we need to load it now... if (File.Exists(uri.LocalPath)) underlyingDoc.Load(uri); underlyingDoc.GraphContext.DefaultsMaterial = _activeMaterialContext.MaterialName; underlyingDoc.GraphContext.PreviewModelFile = "game/model/galleon/galleon.dae"; var doc = new DiagramDocument(underlyingDoc, uri) { NodeFactory = _nodeFactory }; var control = _exportProvider.GetExport<Controls.IDiagramControl>().Value; control.SetContext(doc); // Create a control for the new document, and register it! _controlRegistry.RegisterControl( doc, control.As<Control>(), new ControlInfo(Path.GetFileName(uri.LocalPath), uri.LocalPath, StandardControlGroup.Center) { IsDocument = true }, this); return doc; }
public ControlInfo GetControlInfo(DiagramDocument domNode) { return (from ctrol in _controls where ctrol.Key == domNode select ctrol.Value.Second).FirstOrDefault(); }
public virtual void RegisterControl(DiagramDocument doc, Control control, ControlInfo controlInfo, IControlHostClient client) { _controls.Add(doc, new Pair<Control, ControlInfo>(control, controlInfo)); _hostService.RegisterControl(control, controlInfo, client); }