C# Class Revit.SDK.Samples.PrintLog.CS.EventsReactor

This class has four handler methods which will be subscribed to ViewPrint and DocumentPrint events separately, It contains other methods which are used to dump related information to log files. The handler methods will be used to dump designed information to log files when they are raised by Print operations(both UI and API). This class contains two log file handlers m_printLog and m_eventsLog, they will dump information to PrintLog.txt and PrintEventsLog.txt separately. PrintEventsLog.txt only contains the information of events, like events arguments and sequences. The PrintLog.txt contains all information of print, date time stamp and cost time of print are dumped especially.
Exibir arquivo Open project: AMEE/revit Class Usage Examples

Public Methods

Method Description
AppDocumentPrinted ( object sender, Autodesk e ) : void

Handler method for DocumentPrinted event. This method will dump all views printed and failed views(if any), total for all print.

AppDocumentPrinting ( object sender, Autodesk e ) : void

Handler method for DocumentPrinting event. This method will dump printer name, views to be printed and user name, etc. Besides, this handler will reserve the start time of whole print process.

AppViewPrinted ( object sender, Autodesk e ) : void

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.

AppViewPrinting ( object sender, Autodesk e ) : void

Handler method for ViewPrinting event. This method will dump detailed information of view, like view type, id and start start time of print for this view.

CloseLogFiles ( ) : void

Close log files now

EventsReactor ( ) : System

Constructor method This method will only initialize the m_docEventsWatches and m_assemblyPath. Notice that this method won't open log files.

Private Methods

Method Description
DumpDateTime ( string prefix ) : void

This method will dump date time to log file, but it will only dump to PrintLog.txt file. The date/time stamp should not be dumped to PrintEventsLog.txt.

DumpEventArguments ( RevitAPIEventArgs eventArgs ) : void

Dump the events arguments to log files: PrintLog.txt and PrintEventsLog.txt. This method will only dump EventArguments of ViewPrint and DocumentPrint, that's, 4 event arguments will be handled here: . DocumentPrintingEventArgs . DocumentPrintedEventArgs . ViewPrintingEventArgs . ViewPrintedEventArgs

DumpPrintEnv ( String user, String printer, String projectName ) : void

Dump global environment of print: user, printer and project name. This only will be dumped to PrintLog.txt.

DumpViewInfo ( View view, String prefix ) : void

Dump information of single view: ViewType and ViewName. The information will be dumped to both PrintLog.txt and PrintEventsLog.txt.

DumpViewsInfo ( Document activeDoc, IList viewIds, String prefix ) : void

Dump information of views: ViewType, Id and ViewName. The information will be dumped to both PrintLog.txt and PrintEventsLog.txt.

SetupLogFiles ( ) : void

For singleton consideration, setup log file only when events are raised. m_printLog and m_eventsLog will be initialized and added to Trace.Listeners PrintLog.txt and PrintEventsLog.txt will be removed if existed.

StartNewWatch ( Document curDoc, bool isViewWatch ) : void

Start to dump current date/time and start watch count.

StopWatch ( Document curDoc, bool isViewWatch ) : void

Stop watch for print and then calculate the time cost, Besides, it will dump current date time to PrintLog.txt.

Method Details

AppDocumentPrinted() public method

Handler method for DocumentPrinted event. This method will dump all views printed and failed views(if any), total for all print.
public AppDocumentPrinted ( object sender, Autodesk e ) : void
sender object
e Autodesk
return void

AppDocumentPrinting() public method

Handler method for DocumentPrinting event. This method will dump printer name, views to be printed and user name, etc. Besides, this handler will reserve the start time of whole print process.
public AppDocumentPrinting ( object sender, Autodesk e ) : void
sender object
e Autodesk
return void

AppViewPrinted() public method

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.
public AppViewPrinted ( object sender, Autodesk e ) : void
sender object
e Autodesk
return void

AppViewPrinting() public method

Handler method for ViewPrinting event. This method will dump detailed information of view, like view type, id and start start time of print for this view.
public AppViewPrinting ( object sender, Autodesk e ) : void
sender object
e Autodesk
return void

CloseLogFiles() public method

Close log files now
public CloseLogFiles ( ) : void
return void

EventsReactor() public method

Constructor method This method will only initialize the m_docEventsWatches and m_assemblyPath. Notice that this method won't open log files.
public EventsReactor ( ) : System
return System