private void OnSaveClick(object sender, LinkLabelLinkClickedEventArgs e) { try { using (var dlg = new SaveFileDialog()) { dlg.Filter = Resources.XML_FILE; if (dlg.ShowDialog() != DialogResult.OK) { return; } using (XmlWriter writer = new XmlTextWriter(dlg.FileName, Encoding.UTF8)) { var serializer = new XmlSerializer(typeof(Appearance)); var app = new Appearance(); app.Bar.Assign((AppearanceBar)pgrdBar.SelectedObject); app.Item.Assign((AppearanceItem)pgrdItem.SelectedObject); serializer.Serialize(writer, app); writer.Flush(); writer.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Assigns Values of supplied <see cref="Appearance"/> to current object. /// </summary> /// <param name="appearance"><see cref="Appearance"/> object whose value is to be assigned.</param> public void Assign(Appearance appearance) { Bar.Assign(appearance.Bar); Item.Assign(appearance.Item); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> /// <filterpriority>2</filterpriority> public object Clone() { var app = new Appearance(); app.Bar.Assign((AppearanceBar) bar.Clone()); app.Item.Assign((AppearanceItem) item.Clone()); return app; }
/// <summary> /// Assigns Values of supplied <see cref="Appearance"/> to current object. /// </summary> /// <param name="appearance"><see cref="Appearance"/> object whose value is to be assigned.</param> public void Assign(Appearance appearance) { Bar.Assign(appearance.Bar); Item.Assign(appearance.Item); }
private void OnSaveClick(object sender, LinkLabelLinkClickedEventArgs e) { try { using (var dlg = new SaveFileDialog()) { dlg.Filter = Resources.XML_FILE; if (dlg.ShowDialog() != DialogResult.OK) return; using (XmlWriter writer = new XmlTextWriter(dlg.FileName, Encoding.UTF8)) { var serializer = new XmlSerializer(typeof (Appearance)); var app = new Appearance(); app.Bar.Assign((AppearanceBar) pgrdBar.SelectedObject); app.Item.Assign((AppearanceItem) pgrdItem.SelectedObject); serializer.Serialize(writer, app); writer.Flush(); writer.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }