private void Doc_DocumentSaving(object sender, Autodesk.Revit.DB.Events.DocumentSavingEventArgs e) { if (e.Cancellable) { e.Cancel(); ShowMessage("取消事件"); } }
// Show a message to decide whether to save the document. void a_DocumentSaving( object obj, DocumentSavingEventArgs args) { // Ask whether to prevent from saving: bool cancel = args.Cancellable && LabUtils.QuestionMsg( "Saving event handler was triggered.\r\n" + "Using the pre-event mechanism, we can cancel the save.\r\n" + "Continue saving the document?"); //args.Cancel = cancel; // 2011 if (cancel) { args.Cancel(); } // 2012 }