protected override void RequestLoad(DesignService service, DesignBuffer buffer)
        {
            var document = new DilxDocument();

            document.Read(buffer.LoadData());

            Ancestors ancestors;
            IHost     host;
            XDocument ancestor = null;

            if (document.Ancestors.Count >= 1)
            {
                ancestors = document.Ancestors;
                ancestor  = MergeAncestors(ancestors);
                var merge   = XDocument.Load(new StringReader(document.Content));
                var current = new XDocument();
                current.Add(new XElement(ancestor.Root));
                Inheritance.Merge(current, merge);
                host = HostFromDocumentData(current, GetDocumentExpression(buffer));
            }
            else
            {
                host      = HostFromDocumentData(document.Content, GetDocumentExpression(buffer));
                ancestors = null;
            }
            SetDesignHost(host, true);
            UpdateReadOnly(ancestor);
            _ancestors = ancestors;
        }
Example #2
0
 private void DesignerRequestedSave(DesignService service, DesignBuffer buffer)
 {
     if (_service != null)
     {
         _service.SetModified(true);
     }
 }
Example #3
0
        protected string GetDocumentExpression(DesignBuffer buffer)
        {
            var localBuffer = buffer as DocumentDesignBuffer;

            if (localBuffer == null)
            {
                return(String.Empty);
            }
            return(String.Format(".Frontend.Form('{0}', '{1}')", localBuffer.LibraryName, localBuffer.DocumentName));
        }
Example #4
0
        protected virtual void RequestSave(DesignService service, DesignBuffer buffer)
        {
            Serializer serializer = FrontendSession.CreateSerializer();
            var        document   = new XDocument();

            serializer.Serialize(document, _designHost.Children[0]);
            Dataphoria.Warnings.AppendErrors(this, serializer.Errors, true);

            var stream        = new MemoryStream();
            var xmlTextWriter = XmlWriter.Create(stream, new XmlWriterSettings()
            {
                Encoding = Encoding.UTF8, Indent = true
            });

            document.Save(xmlTextWriter);
            xmlTextWriter.Flush();
            byte[] writerString = stream.ToArray();
            buffer.SaveData(Encoding.UTF8.GetString(writerString, 0, writerString.Length));

            UpdateHostsDocument(buffer);
        }
        protected override void RequestSave(DesignService service, DesignBuffer buffer)
        {
            var document = new DilxDocument();

            if (_ancestors != null)
            {
                document.Ancestors = _ancestors;
            }

            var        content    = new XDocument();
            Serializer serializer = FrontendSession.CreateSerializer();

            serializer.Serialize(content, DesignHost.Children[0]);
            Dataphoria.Warnings.AppendErrors(this, serializer.Errors, true);

            if (_ancestors != null)
            {
                content = Inheritance.Diff(MergeAncestors(document.Ancestors), content);
            }
            document.Content = content.Root.ToString(); // only the document node

            buffer.SaveData(document.Write());
            UpdateHostsDocument(buffer);
        }
Example #6
0
 public void Open(DesignBuffer buffer)
 {
     _service.Open(buffer);
 }
Example #7
0
 protected virtual void RequestSave(DesignService service, DesignBuffer buffer)
 {
     buffer.SaveData(SavePlan());
 }
Example #8
0
 protected virtual void RequestLoad(DesignService service, DesignBuffer buffer)
 {
     LoadPlan(buffer.LoadData());
 }
Example #9
0
 protected void UpdateHostsDocument(DesignBuffer buffer)
 {
     DesignHost.Document = GetDocumentExpression(buffer);
 }
Example #10
0
 protected IHost HostFromBuffer(DesignBuffer buffer)
 {
     return(HostFromDocumentData(buffer.LoadData(), GetDocumentExpression(buffer)));
 }
Example #11
0
 protected virtual void RequestLoad(DesignService service, DesignBuffer buffer)
 {
     SetDesignHost(HostFromBuffer(buffer), true);
 }
Example #12
0
 private void SaveData(DesignService service, DesignBuffer buffer)
 {
     buffer.SaveData(EditorText);
 }
Example #13
0
 private void LoadData(DesignService service, DesignBuffer buffer)
 {
     EditorText = buffer.LoadData();
 }