/// <summary> /// This event is fired whenever a document is saved as. /// Update door's information according to door's current geometry. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">An DocumentSavingAsEventArgs that contains the DocumentSavingAs event data.</param> private void DocumentSavingAsHandler(Object sender, DocumentSavingAsEventArgs args) { string message = ""; Transaction tran = null; try { Document doc = args.Document; if (doc.IsModifiable) { if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded) { TaskDialog.Show("Door Swing", message); } } else { tran = new Transaction(doc, "Update parameters in Saving event"); tran.Start(); if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded) { TaskDialog.Show("Door Swing", message); } tran.Commit(); } } catch (Exception ex) { // if there are something wrong, give error message. TaskDialog.Show("Door Swing", ex.Message); if (null != tran) { if (tran.HasStarted() && !tran.HasEnded()) { tran.RollBack(); } } } }
/// <summary> /// Delegate for document save as event, it will update spreadsheet if document was mapped to spreadsheet. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">EventArgs of this event.</param> public void DocumentSavingAs(object sender, DocumentSavingAsEventArgs e) { DumpLog("Raised DocumentSavingAs -> Document: " + Path.GetFileNameWithoutExtension(e.Document.Title)); UpdateMappedSpreadsheet(e.Document); }
/// <summary> /// This event is fired whenever a document is saved as. /// Update door's information according to door's current geometry. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">An DocumentSavingAsEventArgs that contains the DocumentSavingAs event data.</param> private void DocumentSavingAsHandler(Object sender, DocumentSavingAsEventArgs args) { string message = ""; Transaction tran = null; try { Document doc = args.Document; if (doc.IsModifiable) { if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded) MessageBox.Show(message, "Door Swing"); } else { tran = new Transaction(doc, "Update parameters in Saving event"); tran.Start(); if (DoorSwingData.UpdateDoorsInfo(args.Document, false, false, ref message) != Autodesk.Revit.UI.Result.Succeeded) MessageBox.Show(message, "Door Swing"); tran.Commit(); } } catch (Exception ex) { // if there are something wrong, give error message. MessageBox.Show(ex.Message, "Door Swing"); if (null != tran) { if (tran.HasStarted() && !tran.HasEnded()) { tran.RollBack(); } } } }
/// <summary> /// Delegate for document save as event, it will update spreadsheet if document was mapped to spreadsheet. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">EventArgs of this event.</param> public void DocumentSavingAs(object sender, DocumentSavingAsEventArgs e) { DumpLog("Raised DocumentSavingAs -> Document: " + Path.GetFileNameWithoutExtension(e.Document.Title)); UpdateMappedSpreadsheet(e.Document); }
private void doc_DocumentSavingAs(object sender, DocumentSavingAsEventArgs e) { DisplayEvent("Document saving as"); }