void OnEndingComputeThread(ThreadComputeInterface tci) { ListViewItem item = new ListViewItem(); item.Text = tci.HashMethod; var subItem = new ListViewItem.ListViewSubItem(); subItem.Text = tci.Result; item.SubItems.Add(subItem); lvMain.Items.Add(item); }
void StartOfComputeThread(object obj) { ThreadComputeInterface ti = (ThreadComputeInterface)obj; ti.Parent.BeginInvoke(new VCDelegate(OnStartComputeThread), ti); try { using (HashAlgorithm ha = ti.CreateHashAlgorithm()) { byte[] result = ha.ComputeHash(ti.Pipe); ti.Result = BitConverter.ToString(ha.Hash).Replace("-", ""); } } catch (Exception ex) { Alert(ex.Message); } ti.ClosePipe(); ti.Parent.EndInvoke(ti.Parent.BeginInvoke(new VCDelegate(OnEndingComputeThread), ti)); ti.Parent.BeginInvoke(new VCDelegate(OnEndedComputeThread), ti); }
void OnEndedComputeThread(ThreadComputeInterface tci) { Debug.Assert(!InvokeRequired); this.BeginInvoke(new VCloseThread(closeThread), tci.TheThread); --_totalThreadCount; }
void OnStartComputeThread(ThreadComputeInterface tci) { Debug.Assert(!InvokeRequired); ++_totalThreadCount; }