/[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

revision 114 by william, Sun Mar 10 15:58:25 2013 UTC revision 115 by william, Sun Mar 10 16:07:38 2013 UTC
# Line 230  namespace xmltv_parser Line 230  namespace xmltv_parser
230              }              }
231          }          }
232    
233            private void DeserializeDataFromFile(object filename)
234            {
235                if (filename == null) { throw new ArgumentNullException("filename", "cannot be null"); }
236                bool status = false;
237                IXMLTVRuntimeInstance xmltv = XMLTV.DeSerialize(filename.ToString(), out status);
238                XMLTV.CreateFromInstance(xmltv, new EventHandler<EventArgs>(XMLTV_OnInstanceCreated));
239                if (!status)
240                {
241                    MessageBox.Show("Failed to load data - check log", "Failed to load data", MessageBoxButtons.OK, MessageBoxIcon.Error);
242                    return;
243                }
244                MessageBox.Show("Successfully loaded data", "Successfully loaded data", MessageBoxButtons.OK, MessageBoxIcon.Information);
245            }
246    
247          private void mnuItemOpenSavedData_Click(object sender, EventArgs e)          private void mnuItemOpenSavedData_Click(object sender, EventArgs e)
248          {          {
249              try              try
# Line 237  namespace xmltv_parser Line 251  namespace xmltv_parser
251                  var result = xmltv_program_data_loader.ShowDialog();                  var result = xmltv_program_data_loader.ShowDialog();
252                  if (result != DialogResult.OK) return;                  if (result != DialogResult.OK) return;
253                  string filename = xmltv_program_data_loader.FileName;                  string filename = xmltv_program_data_loader.FileName;
254                  IXMLTVRuntimeInstance xmltv = null;                  Thread worker = new Thread(new ParameterizedThreadStart(DeserializeDataFromFile)); worker.Start(filename);
                 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);  
255              }              }
256              catch (Exception ex)              catch (Exception ex)
257              {              {

Legend:
Removed from v.114  
changed lines
  Added in v.115

  ViewVC Help
Powered by ViewVC 1.1.22