private IEnumerable <IResult> HandleScriptClosing(ScriptEditorViewModel script) { if (script.IsDirty) { var message = Result.ShowMessageBox(script.Filename, string.Format("Do you want to save changes to {0}", script.Filename), MessageBoxButton.YesNoCancel); yield return(message); if (message.Result == MessageBoxResult.Cancel) { yield return(Result.Cancel()); } else if (message.Result == MessageBoxResult.Yes) { foreach (var result in scriptDialogStrategy.SaveAs(script, true, path => fileSystem.WriteAllText(path, script.FileContent))) { yield return(result); } } } }
public IEnumerable <IResult> SaveScript(PanelViewModel document) { return(scriptDialogStrategy.SaveAs(document, false, path => Save(document, path))); }