private void WindowsControlDeseralizer(Window C) { if (C == null) { return; } DMT_Main_Window_Control_SaveState pp = new DMT_Main_Window_Control_SaveState( ); XmlSerializer x = new XmlSerializer(pp.GetType( )); StringReader XmlStringReader = new StringReader(XmlFileContents); XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { IgnoreComments = true, IgnoreProcessingInstructions = true, IgnoreWhitespace = true }; XmlReader xmlReader = XmlReader.Create(XmlStringReader, xmlReaderSettings); Object o = x.Deserialize(xmlReader); pp = ( DMT_Main_Window_Control_SaveState )o; C.Left = pp.Left; C.Top = pp.Top; }
private void DMT_Main_Window_Control_SaveState_Seralize(String name) { String StateFileName = String.Format("{0}.xml", this.Name); DMT_Main_Window_Control_SaveState p = new DMT_Main_Window_Control_SaveState( ); p.CommonFields.ControlClass = nameof(Window); p.CommonFields.ControlName = this.DMT_Main_Window_Control.Name; p.CommonFields.SaveStateFileName = StateFileName; p.CommonFields.UpdatedFromXmlFiles = true; p.Left = this.DMT_Main_Window_Control.Left; p.Top = this.DMT_Main_Window_Control.Top; XmlSerializer x = new XmlSerializer(p.GetType( )); XmlWriterSettings s = new XmlWriterSettings { Indent = true, NewLineOnAttributes = true, OmitXmlDeclaration = true }; XmlWriter w = XmlWriter.Create(StateFileName, s); x.Serialize(w, p); w.Close( ); }