C# Class Revit.SDK.Samples.CancelSave.CS.CancelSave

Inheritance: IExternalApplication
显示文件 Open project: AMEE/revit

Public Methods

Method Description
OnShutdown ( UIControlledApplication application ) : Autodesk.Revit.UI.Result

Implement OnShutdown method of IExternalApplication interface.

OnStartup ( UIControlledApplication application ) : Autodesk.Revit.UI.Result

Implement OnStartup method of IExternalApplication interface. This method subscribes to DocumentOpened, DocumentCreated, DocumentSaving and DocumentSavingAs events. The first two events are used to reserve "Project Status" original value; The last two events are used to check whether "Project Status" has been updated, and re-reserve current value as new original value for next compare.

Private Methods

Method Description
CheckProjectStatusUpdate ( Object sender, RevitAPIPreDocEventArgs args ) : void

Event handler method for DocumentSaving and DocumentSavingAs events. This method will check whether "Project Status" has been updated, and reserve current value as original value.

DealNotUpdate ( RevitAPIPreDocEventArgs args ) : void

Deal with the case that the project status wasn't updated. If the event is Cancellable, cancel it and inform user else just inform user the status.

DetectAddinFileLocation ( Autodesk applictaion ) : string
ReservePojectOriginalStatus ( Object sender, RevitAPIPostDocEventArgs args ) : void

Event handler method for DocumentOpened and DocumentCreated events. This method will reserve "Project Status" value after document has been opened or created.

RetrieveProjectCurrentStatus ( System.Windows.Forms.Document doc ) : string

Retrieve current value of Project Status.

Method Details

OnShutdown() public method

Implement OnShutdown method of IExternalApplication interface.
public OnShutdown ( UIControlledApplication application ) : Autodesk.Revit.UI.Result
application UIControlledApplication Controlled application to be shutdown.
return Autodesk.Revit.UI.Result

OnStartup() public method

Implement OnStartup method of IExternalApplication interface. This method subscribes to DocumentOpened, DocumentCreated, DocumentSaving and DocumentSavingAs events. The first two events are used to reserve "Project Status" original value; The last two events are used to check whether "Project Status" has been updated, and re-reserve current value as new original value for next compare.
public OnStartup ( UIControlledApplication application ) : Autodesk.Revit.UI.Result
application UIControlledApplication Controlled application to be loaded to Revit process.
return Autodesk.Revit.UI.Result