ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/xmltv_parser/trunk/xmltv_parser/main.cs
(Generate patch)

Comparing trunk/xmltv_parser/main.cs (file contents):
Revision 115 by william, Sun Mar 10 16:07:38 2013 UTC vs.
Revision 116 by william, Sun Mar 10 16:09:35 2013 UTC

--- trunk/xmltv_parser/main.cs	2013/03/10 16:07:38	115
+++ trunk/xmltv_parser/main.cs	2013/03/10 16:09:35	116
@@ -258,7 +258,16 @@ namespace xmltv_parser
                 gLog.Error.WriteLine(ex.ToString());
             }
         }
-
+        private void DeserializeDataToFile(object filename)
+        {
+            if (filename == null) { throw new ArgumentNullException("filename", "cannot be null"); }
+            if (!XMLTV.Serialize(filename.ToString()))
+            {
+                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);
+        }
         private void mnuItemSaveData_Click(object sender, EventArgs e)
         {
             try
@@ -266,12 +275,7 @@ namespace xmltv_parser
                 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);
+                Thread worker = new Thread(new ParameterizedThreadStart(DeserializeDataToFile)); worker.Start(filename);
             }
             catch (Exception ex)
             {