void OnIdling( object sender, IdlingEventArgs e )
{
// access active document from sender:
//Application app = sender as Application; // 2011
//Debug.Assert( null != app, // 2011
// "expected a valid Revit application instance" ); // 2011
//UIApplication uiapp = new UIApplication( app ); // 2011
UIApplication uiapp = sender as UIApplication; // 2012
Document doc = uiapp.ActiveUIDocument.Document;
Log( "OnIdling with active document "
+ doc.Title );
}