Пример #1
0
 private void LoggingEventHandler(Object sender, LoggingEventArgs e)
 {
     if( dispatcher != null )
     {
         dispatcher.BeginInvoke(
             DispatcherPriority.Normal,
             (ThreadStart)delegate()
             {
                 LoggingEventHandlerDispatched(sender,e);
             });
     }
     else
     {   // Thread has not even started yet.
         LoggingEventHandlerDispatched(sender, e);
     }
 }
Пример #2
0
 private void OnLoggingEvent(LoggingEventArgs args)
 {
     if( loggingEventHandler != null )
     {
         loggingEventHandler(this, args);
     }
 }
Пример #3
0
 private void LoggingEventHandlerDispatched(Object sender, LoggingEventArgs e)
 {
     if (e is LoggingFileEventArgs)
     {
         var ea = (LoggingFileEventArgs)e;
         if( indexFile != null )
         {
             using (System.IO.StreamWriter file = new System.IO.StreamWriter(indexFile, true))
             {
                 file.WriteLine(ea.ScanTime.TotalSeconds + "," + Path.GetFileName(ea.File));
                 //file.WriteLine(ea.ScanTime.TotalSeconds + "," + ea.File);
             }
         }
     }
     else if (e is LoggingStartedEventArgs)
     {
         var ea = (LoggingStartedEventArgs)e;
         saveFolder = ea.SavedToFolder;
         indexFile = System.IO.Path.Combine(saveFolder, "index.csv");
     }
     else if (e is LoggingStoppedEventArgs)
     {
         Kill();
     }
 }