void CloseTab_Executed(object sender, ExecutedRoutedEventArgs args) { if (sender == this) { XamlDocument document = null; if (args.Parameter != null) { document = args.Parameter as XamlDocument; } else if (this.DocumentsView.SelectedView != null) { document = this.DocumentsView.SelectedView.XamlDocument; } if (document != null) { if (document.NeedsSave) { MessageBoxResult result = MessageBox.Show("The document " + document.Filename + " has not been saved. Would you like to save it before closing?", "Save Document", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { document.Save(); } if (result == MessageBoxResult.Cancel) { return; } } this.DocumentsView.XamlDocuments.Remove(document); } } }
public bool Save(XamlDocument document) { if (document.UsingTemporaryFilename) { return(SaveAs(document)); } else { return(document.Save()); } }
/// <summary> /// Saves the XAML DOM into the XML writer. /// </summary> public override void Save(System.Xml.XmlWriter writer) { _doc.Save(writer); }