/// <summary> /// Loads a designer from persistence. /// </summary> /// <param name="serializationManager">An <see cref="T:System.ComponentModel.Design.Serialization.IDesignerSerializationManager"/> to use for loading state for the designers.</param> protected override void PerformLoad(IDesignerSerializationManager serializationManager) { // The loader will put error messages in here. ICollection errors = new ArrayList(); bool successful = true; Trace.WriteLine("PerformLoad"); frameXmlHierarchy = DeserializeFrameXml(this.Buffer); this.LayoutFrames = new LayoutFrameCollection(frameXmlHierarchy); this.CreateRootControl(frameXmlHierarchy); // Query for the settings service and get the background image setting IInterfaceStudioSettings settings = GetService(typeof(IInterfaceStudioSettings)) as IInterfaceStudioSettings; if (settings != null) { this.RootControl.BackgroundImagePath = settings.BackgroundImageFile; } // Add PropertyValueUIHandler to PropertyValueUIService this.AddPropertyValueUIHandler(); // Let the host know we are done loading. Host.EndLoad(FrameXmlDesignerLoader.hostedBaseClassName, successful, errors); }
/// <summary> /// Retrieves the serialization object hierarchy of the root control. /// </summary> /// <returns></returns> private Serialization.Ui GetSerializationObject() { Controls.Ui rootControl = this.RootControl; Serialization.Ui rootObject = rootControl.TypedSerializationObject; // remove objects that are shown in the view - they will be serialized rootObject.Controls.RemoveAll(obj => objectsInView.Contains(obj)); List <SerializationObject> objects = new List <SerializationObject>(rootObject.Controls); foreach (Controls.ISerializableControl childControl in rootControl.BaseControls) { Serialization.SerializationObject childObject = GetSerializationObject(childControl); objects.Add(childObject); // add eventual new controls to the view if (!objectsInView.Contains(childObject)) { objectsInView.Add(childObject); } } rootObject.Controls.Clear(); rootObject.Controls.AddRange(objects.SortRootObjects()); return(rootObject); }
private void PostProcessSerializationHierarchy(Serialization.Ui ui) { foreach (var layoutFrame in ui.Controls.OfType <LayoutFrameType>()) { PostProcessSerializationHierarchy(layoutFrame, null); } }
private void CreateRootControl(Serialization.Ui ui) { this.IsLoading = true; try { // just create the root component this.CreateControl(ui, null); this.BaseControls = new BaseControlCollection(this.RootControl); } finally { this.IsLoading = false; } }
public LayoutFrameCollection(Serialization.Ui frameXmlHierarchy) { this.frameXmlHierarchy = frameXmlHierarchy; }
/// <summary> /// Loads a designer from persistence. /// </summary> /// <param name="serializationManager">An <see cref="T:System.ComponentModel.Design.Serialization.IDesignerSerializationManager"/> to use for loading state for the designers.</param> protected override void PerformLoad(IDesignerSerializationManager serializationManager) { // The loader will put error messages in here. ICollection errors = new ArrayList(); bool successful = true; Trace.WriteLine("PerformLoad"); frameXmlHierarchy = DeserializeFrameXml(this.Buffer); this.LayoutFrames = new LayoutFrameCollection(frameXmlHierarchy); this.CreateRootControl(frameXmlHierarchy); // Query for the settings service and get the background image setting IInterfaceStudioSettings settings = GetService(typeof(IInterfaceStudioSettings)) as IInterfaceStudioSettings; if (settings != null) this.RootControl.BackgroundImagePath = settings.BackgroundImageFile; // Add PropertyValueUIHandler to PropertyValueUIService this.AddPropertyValueUIHandler(); // Let the host know we are done loading. Host.EndLoad(FrameXmlDesignerLoader.hostedBaseClassName, successful, errors); }