private void SaveAll() { foreach (var curTab in XamlTabs) { if ((curTab.Status & TabStatus.NoSave) != TabStatus.NoSave) { continue; } if (!File.Exists(curTab.FileName)) { if (string.IsNullOrEmpty(XVCommon.ShowSaveFileDialog(curTab.FileName))) { continue; } } if (!curTab.IsSelected) { curTab.SaveToFile(); continue; } curTab.Save(); } }
private void CloseXamlTab(TabViewModel tab, bool ignoreSaving = false) { if (!ignoreSaving && (tab.Status & TabStatus.Inner) != TabStatus.Inner) { if (!FileHelper.Exists(tab.FileName)) { _dialogService.ShowMessage(string.Format("Save file \"{0}\"?", tab.FileName), MessageButton.YesNo, MessageType.Question, r => { if (r.Result == ButtonResult.Yes) { var fileName = XVCommon.ShowSaveFileDialog(tab.FileName); if (!string.IsNullOrEmpty(fileName)) { tab.UpdateFileName(fileName); tab.SaveToFile(); } } }); } else { if ((tab.Status & TabStatus.NoSave) == TabStatus.NoSave) { _dialogService.ShowMessage(string.Format("Save file \"{0}\"?", Path.GetFileName(tab.FileName)), MessageButton.YesNo, MessageType.Question, r => { if (r.Result == ButtonResult.Yes) { tab.SaveToFile(); } }); } } } Remove(tab); }