public async Task CloseDocument(OpenDocumentViewModel document) { if (document == null) { return; } var result = await document.Save(promptSave : true).ConfigureAwait(true); if (result == SaveResult.Cancel) { return; } // ReSharper disable once PossibleNullReferenceException var autoSavePath = document.Document?.GetAutoSavePath(); if (autoSavePath != null && File.Exists(autoSavePath)) { File.Delete(autoSavePath); } RoslynHost.CloseDocument(document.DocumentId); OpenDocuments.Remove(document); document.Close(); }
public async Task CloseDocument(OpenDocumentViewModel document) { var result = await document.Save(promptSave : true).ConfigureAwait(true); if (result == SaveResult.Cancel) { return; } if (document.Document?.IsAutoSave == true) { File.Delete(document.Document.Path); } RoslynHost.CloseDocument(document.DocumentId); OpenDocuments.Remove(document); document.Close(); }