コード例 #1
0
        public static StateChartDocument LoadXml(Stream ifile)
        {
            GoXmlReader xr = new GoXmlReader();

            InitReaderWriter(xr);
            StateChartDocument doc = xr.Consume(ifile) as StateChartDocument;

            if (doc == null)
            {
                return(null);
            }
            return(doc);
        }
コード例 #2
0
ファイル: FlowDocument.cs プロジェクト: lhmson/FlowArt
        public static FlowDocument Load(Stream file, String loc)
        {
            GoXmlReader xr = new GoXmlReader();

            InitReaderWriter(xr);
            FlowDocument doc = xr.Consume(file) as FlowDocument;

            if (doc == null)
            {
                return(null);
            }

            // update the file location
            doc.Location = loc;
            // undo managers are not serialized
            doc.UndoManager = new GoUndoManager();
            doc.IsModified  = false;
            AddDocument(loc, doc);
            return(doc);
        }
コード例 #3
0
ファイル: GraphDoc.cs プロジェクト: lian5599/NewSolution
        public static GraphDoc Load(Stream file, String loc)
        {
            GoXmlReader xr = new GoXmlReader();

            InitReaderWriter(xr);
            GraphDoc doc = xr.Consume(file) as GraphDoc;

            if (doc == null)
            {
                return(null);
            }

            doc.EnsureUniquePartID();
            // update the file location
            doc.Location = loc;
            // undo managers are not serialized
            doc.UndoManager = new GoUndoManager();
            doc.IsModified  = false;
            AddDocument(loc, doc);
            return(doc);
        }
コード例 #4
0
        public void Deserialize(IDiagramModel diagramModel, XmlDocument xmlDoc)
        {
            GoXmlReader reader = new GoXmlReader();

            RegisterTransformers(reader);
            reader.RootObject = diagramModel;
            reader.Consume(xmlDoc);

            if (xmlDoc.DocumentElement.HasAttribute(LocationX) && xmlDoc.DocumentElement.HasAttribute(LocationY))
            {
                float x = Convert.ToSingle(xmlDoc.DocumentElement.GetAttribute(LocationX), CultureInfo.InvariantCulture);
                float y = Convert.ToSingle(xmlDoc.DocumentElement.GetAttribute(LocationY), CultureInfo.InvariantCulture);
                diagramModel.Location = new PointF(x, y);
            }

            if (xmlDoc.DocumentElement.HasAttribute(IsLayouted))
            {
                diagramModel.IsLayouted = Convert.ToBoolean(xmlDoc.DocumentElement.GetAttribute(IsLayouted));
            }

            PostReadStep(diagramModel);
        }