Пример #1
0
        /// <summary>
        /// Called to initialize the view after the corresponding document has been loaded.
        /// </summary>
        protected override bool LoadView()
        {
            base.LoadView();

            global::System.Diagnostics.Debug.Assert(this.DocData.RootElement != null);
            if (this.DocData.RootElement == null)
            {
                return(false);
            }

            // The diagram should exist in the diagram partition by now, just need to find it and connect it to this view.
            PatternModelDocDataBase docData = this.DocData as PatternModelDocDataBase;

            global::System.Diagnostics.Debug.Assert(docData != null, "DocData for PatternModelDocViewBase should be an PatternModelDocDataBase!");
            DslModeling::Partition diagramPartition = docData.GetDiagramPartition();

            if (diagramPartition != null)
            {
                global::System.Collections.ObjectModel.ReadOnlyCollection <global::NuPattern.Runtime.Schema.PatternModelSchemaDiagram> diagrams = docData.GetDiagramPartition().ElementDirectory.FindElements <global::NuPattern.Runtime.Schema.PatternModelSchemaDiagram>();
                if (diagrams.Count > 0)
                {
                    global::System.Diagnostics.Debug.Assert(diagrams.Count == 1, "Found more than one diagram, using the first one found.");
                    this.Diagram = (DslDiagrams::Diagram)diagrams[0];
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
 private void SetCurrentDiagram(PatternModelDocDataBase docData)
 {
     this.Diagram = docData.Store.GetDiagramForDefaultView();
 }
Пример #3
0
 private void SetCurrentDiagram(PatternModelDocDataBase docData)
 {
     this.Diagram = docData.Store.GetDiagramForDefaultView();
 }