Answers for "document save revit api"

C#
0

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;
        }
    }
}
Posted by: Guest on August-21-2021

C# Answers by Framework

Browse Popular Code Answers by Language