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; }
private void DesignerRequestedSave(DesignService service, DesignBuffer buffer) { if (_service != null) { _service.SetModified(true); } }
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)); }
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); }
public void Open(DesignBuffer buffer) { _service.Open(buffer); }
protected virtual void RequestSave(DesignService service, DesignBuffer buffer) { buffer.SaveData(SavePlan()); }
protected virtual void RequestLoad(DesignService service, DesignBuffer buffer) { LoadPlan(buffer.LoadData()); }
protected void UpdateHostsDocument(DesignBuffer buffer) { DesignHost.Document = GetDocumentExpression(buffer); }
protected IHost HostFromBuffer(DesignBuffer buffer) { return(HostFromDocumentData(buffer.LoadData(), GetDocumentExpression(buffer))); }
protected virtual void RequestLoad(DesignService service, DesignBuffer buffer) { SetDesignHost(HostFromBuffer(buffer), true); }
private void SaveData(DesignService service, DesignBuffer buffer) { buffer.SaveData(EditorText); }
private void LoadData(DesignService service, DesignBuffer buffer) { EditorText = buffer.LoadData(); }