Beispiel #1
0
        public static void LoadDoc(string file)
        {
            var io = new GH_DocumentIO();

            if (!io.Open(file))
            {
                throw new Exception("读取文档失败");
            }

            GH_DocumentServer server = Instances.DocumentServer;

            var doc = io.Document;

            if (server == null)
            {
                throw new Exception("读取文档失败");
            }

            server.AddDocument(doc);

            GH_Canvas activeCanvas = Instances.ActiveCanvas;

            if (activeCanvas == null)
            {
                throw new Exception("读取文档失败");
            }

            activeCanvas.Document            = doc;
            activeCanvas.Document.IsModified = false;
            activeCanvas.Refresh();
        }
Beispiel #2
0
        private void LoadGhDocument()
        {
            if (content.type != TaskContentType.file)
            {
                return;
            }

            string file = content.value;

            if (!File.Exists(file))
            {
                ErrorEvent(this, "Work file is not exist!");
                return;
            }
            GH_DocumentIO io = new GH_DocumentIO();

            io.Open(file);

            GH_Document doc = GH_Document.DuplicateDocument(io.Document);

            if (doc == null)
            {
                ErrorEvent(this, "Cannot read this file!");
                return;
            }

            GH_DocumentServer server = Instances.DocumentServer;

            if (server == null)
            {
                ErrorEvent(this, "No Document Server exist!");
                return;
            }

            server.AddDocument(doc);

            doc.Properties.ProjectFileName = ID.ToString();

            GH_Canvas activeCanvas = Instances.ActiveCanvas;

            if (activeCanvas == null)
            {
                ErrorEvent(this, "No Active Canvas exist!");
                return;
            }

            activeCanvas.Document            = doc;
            activeCanvas.Document.IsModified = false;
            activeCanvas.Refresh();

            // SolutionEndCnt = 0;
            doc.SolutionEnd += Doc_SolutionEnd;
            UpdateData(true);
        }
Beispiel #3
0
        private void LoadGhDocument(string file)
        {
            if (!System.IO.File.Exists(file))
            {
                return;
            }
            GH_DocumentIO io = new GH_DocumentIO();

            io.Open(file);

            GH_Document doc = GH_Document.DuplicateDocument(io.Document);

            if (doc == null)
            {
                return;
            }

            GH_DocumentServer server = Instances.DocumentServer;

            if (server == null)
            {
                return;
            }

            server.AddDocument(doc);

            doc.Properties.ProjectFileName = ID.ToString();

            GH_Canvas activeCanvas = Instances.ActiveCanvas;

            if (activeCanvas == null)
            {
                return;
            }

            activeCanvas.Document            = doc;
            activeCanvas.Document.IsModified = false;
            activeCanvas.Refresh();

            doc.SolutionEnd += Doc_SolutionEnd;
        }