add close doc function

This commit is contained in:
Connor Ivy
2023-03-08 12:15:08 -06:00
parent ae31d97bf0
commit 1eebeb7f9c
+17
View File
@@ -47,6 +47,23 @@ namespace xUnitRevitUtils
UiContext.Send(x => doc = Uiapp.OpenAndActivateDocument(filePath).Document, null);
Assert.NotNull(doc);
return doc;
}
/// <summary>
/// Closes the provided Revit document
/// </summary>
/// <param name="doc">Revit document to be closed</param>
/// <param name="saveChanges">If true, saves changes to document before closing</param>
/// <returns>
/// Bool indicating whether or not the document was successfully closed
/// </returns>
public static bool CloseDoc(Document doc, bool saveChanges = false)
{
if (doc == null)
return false;
var result = false;
UiContext.Send(x => result = doc.Close(saveChanges), null);
return result;
}
/// <summary>