/[xmltv_parser]/trunk/xmltv_parser/main.cs
ViewVC logotype

Diff of /trunk/xmltv_parser/main.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/xmltv_parser/main.cs	2013/03/08 02:13:59	36
+++ trunk/xmltv_parser/main.cs	2013/03/08 02:40:55	40
@@ -11,6 +11,7 @@
 using libxmltv.Interfaces;
 using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;
+using System.Threading;
 
 namespace xmltv_parser
 {
@@ -21,7 +22,25 @@
             InitializeComponent();
             string log_path = Application.StartupPath;
             string log_filename = string.Format("{0}.log", typeof(main).Assembly.GetName().Name);
-            gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All);
+            gLog.CreateLog(string.Format(@"{0}\{1}", log_path, log_filename), false, LogLevel.kLogLevel_All, new EventHandler<LoggerOnFlushEventArgs>(Logger_OnFlush));
+        }
+
+        StringBuilder log_flusher = new StringBuilder();
+        void Logger_OnFlush(object sender, LoggerOnFlushEventArgs e)
+        {
+            //Console.Write(e.Buffer);         
+            log_flusher.Append(e.Buffer);
+            if(e.Buffer == System.Environment.NewLine[0])
+            {
+                OnLogFlush(log_flusher.ToString().TrimEnd(new char[] { System.Environment.NewLine[0] }).TrimStart(new char[]{'\n'}));
+                log_flusher = new StringBuilder();
+            }
+        }
+
+        void OnLogFlush(string logmessage)
+        {
+            txtStatus.Text = logmessage;
+            Thread.Sleep(100);
         }
 
         //List<IXMLTVChannel> Channels;

 

  ViewVC Help
Powered by ViewVC 1.1.22