public void Run() { LoadReturn loadReturn = new LoadReturn(); loadReturn.TREFile = null; loadReturn.TreeNode = null; loadReturn.Containers = null; loadReturn.FileTypes = null; this.m_form.Invoke(this.m_form.delegateSetCaption, new Object[] { "Loading " + this.m_filename.Substring(this.m_filename.LastIndexOf("\\") + 1) }); this.m_form.Invoke(this.m_form.delegateSetProgress, new Object[] { new Int32[] { -1 } }); this.m_form.Invoke(this.m_form.delegateSetLabel, new Object[] { "Reading " + this.m_filename.Substring(this.m_filename.LastIndexOf(".") + 1).ToUpper() + "…" }); m_TREFile = new TREFile(this.m_filename); if (m_TREFile.DataTable.Rows.Count > 0) { if (!this.m_Cancelled) { this.m_form.Invoke(this.m_form.delegateSetLabel, new Object[] { "Creating Folder Tree…" }); TreeNode treeNode = CreateTreeNodes(m_TREFile.DataTable); if (!this.m_Cancelled) { this.m_form.Invoke(this.m_form.delegateSetLabel, new Object[] { "Generating Filter Lists…" }); String[][] filters = CreateFilterLists(m_TREFile.DataTable); AddFolders(treeNode); if (!this.m_Cancelled) { loadReturn.TREFile = this.m_TREFile; loadReturn.TreeNode = treeNode; loadReturn.Containers = filters[0]; loadReturn.FileTypes = filters[1]; } } } this.m_form.Invoke(this.m_form.delegateLoadThreadFinished, new Object[] { loadReturn }); } else { this.m_form.Invoke(this.m_form.delegateLoadThreadFinished, new Object[] { loadReturn }); } }
internal void TOCTRELoadFile(String filename) { try { HidePreviewControls(); this.pictureBoxDetails.Image = new Bitmap(this.pictureBoxDetails.Width, this.pictureBoxDetails.Height); this.webBrowserDetails.DocumentText = "<BODY BGCOLOR=\"#" + String.Format("{0:X}", SystemColors.Control.R) + String.Format("{0:X}", SystemColors.Control.G) + String.Format("{0:X}", SystemColors.Control.B) + "\"></BODY>"; this.Text = "TRE Explorer " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; this.treeView.Nodes.Clear(); m_FormProgress.Show(); this.listView.VirtualListSize = 0; this.listView.Refresh(); this.m_TREFile = null; this.Visible = true; m_Thread = new Thread(new ParameterizedThreadStart(this.LoadThread)); m_Thread.Name = "Load"; m_Thread.Start(filename); } catch (Exception exception) { this.listView.Items.Clear(); this.toolStripButtonExport.Enabled = false; this.Text = this.Text = "TRE Explorer " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; MessageBox.Show("An exception occurred while loading " + filename + ": " + exception.Message, "TRE Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadThreadFinished(LoadReturn loadReturn) { this.m_FormProgress.Hide(); if (loadReturn.TREFile != null) { this.SuspendLayout(); this.m_TREFile = loadReturn.TREFile; this.m_DataViewListView = new DataView(this.m_TREFile.DataTable); this.treeView.SuspendLayout(); this.treeView.Nodes.Clear(); this.treeView.Nodes.Add(loadReturn.TreeNode); this.treeView.ResumeLayout(false); PopulateFilters(loadReturn.Containers, loadReturn.FileTypes); this.treeView.CollapseAll(); this.treeView.Nodes[0].Expand(); this.treeView.SelectedNode = this.treeView.Nodes[0]; this.toolStripMenuItemNavigationPane.Checked = true; this.toolStripMenuItemPreviewPane.Checked = true; this.toolStripMenuItemDetailsPane.Checked = true; this.ResumeLayout(false); this.Focus(); } else { this.Text = "TRE Explorer " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; this.toolStripMenuItemNavigationPane.Checked = false; this.toolStripMenuItemPreviewPane.Checked = false; this.toolStripMenuItemDetailsPane.Checked = false; } m_ManualResetEvent_StopThread.Reset(); m_ManualResetEvent_ThreadStopped.Reset(); }