コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public ControlInfo GetControlInfo(DiagramDocument domNode)
 {
     return((from ctrol in _controls where ctrol.Key == domNode select ctrol.Value.Second).FirstOrDefault());
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: MaterialTool.cs プロジェクト: coreafive/XLE
        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;
        }
コード例 #7
0
 public ControlInfo GetControlInfo(DiagramDocument domNode)
 {
     return (from ctrol in _controls where ctrol.Key == domNode select ctrol.Value.Second).FirstOrDefault();
 }
コード例 #8
0
 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);
 }