/[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 06:15:44	50
+++ trunk/xmltv_parser/main.cs	2013/03/08 07:01:37	52
@@ -37,7 +37,7 @@
         bool HAVE_CR = false;
         void Log_OnFlush(object sender, LoggerOnFlushEventArgs e)
         {
-            
+
             log_flusher.Append(e.Buffer);
             if (IsUnix)
             {
@@ -48,7 +48,7 @@
                 }
             }
             else
-            {                
+            {
                 if (e.Buffer == System.Environment.NewLine[0])
                 {
                     HAVE_CR = true;
@@ -60,7 +60,7 @@
                     HAVE_CR = false;
                 }
             }
-            
+
         }
         //bool txtLog_EnterMouse = false;
 
@@ -75,7 +75,7 @@
         void OnLogFlush(string logmessage)
         {
             if (this.IsDisposed) { return; }
-            Console.Write(logmessage);        
+            Console.Write(logmessage);
             txtStatus.Text = logmessage.Replace(System.Environment.NewLine, "");
             txtLog.AppendText(logmessage);
 
@@ -97,7 +97,7 @@
         }
         private void main_Shown(object sender, EventArgs e)
         {
-            
+
         }
 
 
@@ -133,43 +133,64 @@
         }
 
         private void mnuItemOpenXMLTVFile_Click(object sender, EventArgs e)
-        {   
-            //LoadXMLTVShcedule("20130307_continuum_schedule.xml");
-            var result = xmltv_file_chooser.ShowDialog();
-            if (result != DialogResult.OK) return;
-            ClearLocalLog();
-            LoadXMLTVShcedule(xmltv_file_chooser.FileName);
-            CreateControls();
+        {
+            try
+            {
+                //LoadXMLTVShcedule("20130307_continuum_schedule.xml");
+                var result = xmltv_file_chooser.ShowDialog();
+                if (result != DialogResult.OK) return;
+                ClearLocalLog();
+                LoadXMLTVShcedule(xmltv_file_chooser.FileName);
+                CreateControls();
+            }
+            catch (Exception ex)
+            {
+                gLog.Log.Error.WriteLine(ex.ToString());
+            }
         }
 
         private void mnuItemOpenSavedData_Click(object sender, EventArgs e)
         {
-            var result = xmltv_program_data_loader.ShowDialog();
-            if (result != DialogResult.OK) return;
-            string filename = xmltv_program_data_loader.FileName;
-            IXMLTVRuntimeInstance xmltv = null;
-            bool status = false;
-            xmltv = XMLTV.DeSerialize(filename, out status);
-            if (!status)
+            try
             {
-                MessageBox.Show("Failed to load data - check log", "Failed to load data", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                return;
+                var result = xmltv_program_data_loader.ShowDialog();
+                if (result != DialogResult.OK) return;
+                string filename = xmltv_program_data_loader.FileName;
+                IXMLTVRuntimeInstance xmltv = null;
+                bool status = false;
+                xmltv = XMLTV.DeSerialize(filename, out status);
+                if (!status)
+                {
+                    MessageBox.Show("Failed to load data - check log", "Failed to load data", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    return;
+                }
+                MessageBox.Show("Successfully loaded data", "Successfully loaded data", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                CreateControls();
+            }
+            catch (Exception ex)
+            {
+                gLog.Log.Error.WriteLine(ex.ToString());
             }
-            MessageBox.Show("Successfully loaded data", "Successfully loaded data", MessageBoxButtons.OK, MessageBoxIcon.Information); 
-            CreateControls();
         }
 
         private void mnuItemSaveData_Click(object sender, EventArgs e)
         {
-            var result = xmltv_program_data_saver.ShowDialog();
-            if (result != DialogResult.OK) return;
-            string filename = xmltv_program_data_saver.FileName;
-            if (!XMLTV.Serialize(filename))
+            try
+            {
+                var result = xmltv_program_data_saver.ShowDialog();
+                if (result != DialogResult.OK) return;
+                string filename = xmltv_program_data_saver.FileName;
+                if (!XMLTV.Serialize(filename))
+                {
+                    MessageBox.Show("Failed to save data - check log", "Failed to save data", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    return;
+                }
+                MessageBox.Show("Successfully saved data", "Successfully saved data", MessageBoxButtons.OK, MessageBoxIcon.Information);
+            }
+            catch (Exception ex)
             {
-                MessageBox.Show("Failed to save data - check log", "Failed to save data", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                return;
+                gLog.Log.Error.WriteLine(ex.ToString());
             }
-            MessageBox.Show("Successfully saved data", "Successfully saved data", MessageBoxButtons.OK, MessageBoxIcon.Information); 
         }
 
         private void main_FormClosing(object sender, FormClosingEventArgs e)

 

  ViewVC Help
Powered by ViewVC 1.1.22