document save revit api
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace RevitAddin12.Revit
{
public class AppSave : IExternalApplication
{
public Result OnStartup(UIControlledApplication application)
{
application.ControlledApplication.DocumentSaved += ControlledApplication_DocumentSaved;
application.ControlledApplication.DocumentSavedAs += ControlledApplication_DocumentSavedAs;
return Result.Succeeded;
}
private void ControlledApplication_DocumentSaved(object sender, Autodesk.Revit.DB.Events.DocumentSavedEventArgs e)
{
TaskDialog.Show("Revit", $"Saved {e.Document.PathName}");
}
private void ControlledApplication_DocumentSavedAs(object sender, Autodesk.Revit.DB.Events.DocumentSavedAsEventArgs e)
{
TaskDialog.Show("Revit", $"SavedAs {e.Document.PathName}");
}
public Result OnShutdown(UIControlledApplication application)
{
application.ControlledApplication.DocumentSaved -= ControlledApplication_DocumentSaved;
application.ControlledApplication.DocumentSavedAs -= ControlledApplication_DocumentSavedAs;
return Result.Succeeded;
}
}
}