private void backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { MXFFile mainFile = e.Argument as MXFFile; if (mainFile != null) { BackgroundWorker worker = sender as BackgroundWorker; mainFile.ExecuteValidationTest(worker, true); } }
/// <summary> /// Worker thread! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bgwProcess_DoWork(object sender, DoWorkEventArgs e) { // Open the selected file to read. try { BackgroundWorker worker = sender as BackgroundWorker; // Process the file this.m_MXFFile = new MXFFile(this.Filename, worker, m_eFileParseOptions); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error while opening the file"); } }
/// <summary> /// Process the MXF file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnProcess_Click(object sender, EventArgs e) { // Open the selected file to read. try { MXFFile file = new MXFFile(txtPath.Text); // Reset whole tree this.treeMain.Nodes.Clear(); // Add main node TreeNode mainNode = this.treeMain.Nodes.Add(file.Filename); mainNode.Tag = file; // And all sub items foreach (MXFKLV subKLV in file.GlobalKLVs) { AddNode(mainNode, subKLV); } // Loop add all partitions TreeNode partitionsNode = mainNode.Nodes.Add(string.Format("{0} Partitions", file.Partitions.Count)); foreach (MXFPartition part in file.Partitions) { // And all sub items TreeNode partNode = AddNode(partitionsNode, part); if (partNode != null) { foreach (MXFKLV subKLV in part.KLVs) { AddNode(partNode, subKLV); } } } partitionsNode.Expand(); if (file.RIP != null) { AddNode(mainNode, file.RIP); } mainNode.Expand(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error while opening the file"); } }
/// <summary> /// Set the file /// </summary> /// <param name="file"></param> public void SetFile(MXFFile file) { m_mainFile = file; }
/// <summary> /// Constructor, duh /// </summary> public FormReport(MXFFile file) { InitializeComponent(); SetFile(file); }