/[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/10 15:58:25	114
+++ trunk/xmltv_parser/main.cs	2013/03/10 16:07:38	115
@@ -230,6 +230,20 @@
             }
         }
 
+        private void DeserializeDataFromFile(object filename)
+        {
+            if (filename == null) { throw new ArgumentNullException("filename", "cannot be null"); }
+            bool status = false;
+            IXMLTVRuntimeInstance xmltv = XMLTV.DeSerialize(filename.ToString(), out status);
+            XMLTV.CreateFromInstance(xmltv, new EventHandler<EventArgs>(XMLTV_OnInstanceCreated));
+            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);
+        }
+
         private void mnuItemOpenSavedData_Click(object sender, EventArgs e)
         {
             try
@@ -237,16 +251,7 @@
                 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);
-                XMLTV.CreateFromInstance(xmltv, new EventHandler<EventArgs>(XMLTV_OnInstanceCreated));
-                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);
+                Thread worker = new Thread(new ParameterizedThreadStart(DeserializeDataFromFile)); worker.Start(filename);
             }
             catch (Exception ex)
             {

 

  ViewVC Help
Powered by ViewVC 1.1.22