Example #1
0
        public IEnumerable <ToolPersistence> Import(DesignerModel model)
        {
            List <ToolPersistence> ret = new List <ToolPersistence>();

            if (string.IsNullOrEmpty(model.Layout))
            {
                return(ret);
            }

            using (TextReader reader = new StringReader(model.Layout))
            {
                RootPersistence persistence = Serializer.Deserialize(reader) as RootPersistence;

                ret.AddRange(persistence.Tools);
            }

            return(ret);
        }
Example #2
0
        public string GetLayout(IEnumerable <ToolPersistence> persistences)
        {
            string ret = string.Empty;

            // DrawingTools
            RootPersistence rootPersist = new RootPersistence()
            {
                Tools = persistences.ToArray()
            };

            using (TextWriter writer = new StringWriter())
            {
                Serializer.Serialize(writer, rootPersist);
                writer.Flush();
                ret = writer.ToString();
            }

            return(ret);
        }