/// <summary> /// Handler method for ViewPrinted event. /// This handler will dump information of printed view, like View name, type and end time of print. /// Besides, It will calculate cost time of print for this view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AppViewPrinted(object sender, Autodesk.Revit.DB.Events.ViewPrintedEventArgs e) { // header information Trace.WriteLine(System.Environment.NewLine + "View Print End: -------"); // // Stop watch and calculate the cost time StopWatch(e.Document, true); // // Dump the events arguments DumpEventArguments(e); }
/// <summary> /// Handler method for ViewPrinted event. /// This handler will dump information of printed view firstly and then delete the TextNote created in pre-event handler. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments of ViewPrinted event.</param> public void AppViewPrinted(object sender, Autodesk.Revit.DB.Events.ViewPrintedEventArgs e) { // header information Trace.WriteLine(System.Environment.NewLine + "View Print End: -------"); // // Dump the events arguments DumpEventArguments(e); // // Delete the TextNote element created in ViewPrinting only when view print process succeeded or failed. // We don't care about the delete when event status is Cancelled because no TextNote element // will be created when cancelling occurred. if (RevitAPIEventStatus.Cancelled != e.Status) { //now event framework will not provide transaction, user need start by self(2009/11/18) Transaction eventTransaction = new Transaction(e.Document, "External Tool"); eventTransaction.Start(); e.Document.Delete(m_newTextNoteId); eventTransaction.Commit(); Trace.WriteLine("Succeeded to delete the created TextNote element."); } }
void doc_ViewPrinted(object sender, Autodesk.Revit.DB.Events.ViewPrintedEventArgs e) { DisplayEvent("View printed"); }