public RecentFileList() { Persister = new XmlPersister(); MaxNumberOfFiles = 9; MaxPathLength = 50; MenuItemFormatOneToNine = "_{0}: {2}"; MenuItemFormatTenPlus = "{0}: {2}"; this.Loaded += (s, e) => HookFileMenu(); }
public RecentFileList() { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) Persister = new RegistryPersister(); else Persister = new XmlPersister(); MaxNumberOfFiles = 9; MaxPathLength = 50; MenuItemFormatOneToNine = "_{0}: {2}"; MenuItemFormatTenPlus = "{0}: {2}"; this.Loaded += new RoutedEventHandler(RecentFileList_Loaded); //this.Loaded += ( s, e ) => HookFileMenu(); }
public void SerializationIsBackwardsCompatibleWithXml() { // Fixture setup var config = new Config(); var path = FindFilePath(); var xmlPersister = new XmlPersister(); xmlPersister.Serialize(path, config); // Exercise system var result = Record.Exception(() => Serialization.Deserialize <Config>(path)); // Verify outcome Assert.IsNotType <AggregateException>(result); // Teardown File.Delete(path); }
public RecentFileList() { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { Persister = new RegistryPersister(); } else { Persister = new XmlPersister(); } MaxNumberOfFiles = 9; MaxPathLength = 50; MenuItemFormatOneToNine = "_{0}: {2}"; MenuItemFormatTenPlus = "{0}: {2}"; this.Loaded += new RoutedEventHandler(RecentFileList_Loaded); //this.Loaded += ( s, e ) => HookFileMenu(); }
/// <summary> /// Shows the data source as XML. /// </summary> private void ShowXml() { Cursor oldCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; string xml = null; try { // convert... Type type = this.DataSource.GetType(); XmlPersister persister = new XmlPersister(type, type.Name, Encoding.Unicode); xml = persister.ToXml(this.DataSource); } finally { this.Cursor = oldCursor; } // show... Alert.ShowInformation(this, xml); }
public void UseXmlPersister(Stream stream) { Persister = new XmlPersister(stream); }
public void UseXmlPersister(string filepath) { Persister = new XmlPersister(filepath); }
public void UseXmlPersister() { Persister = new XmlPersister(); }