private async void StartProcessing() { try { SetUICrap_StartProcessing(); foreach (ListViewItem item in listViewMain.Items) { CurrentViewItem = item; // yuk! quick 'n dirty feedback for UI textBoxMain.Text += "\r\n\r\nProcessing: " + ProcessingModel.File.FullName; textBoxMain.Text += "\r\nOutput: " + ProcessorUtil.GetOutputTmFullPath(ProcessingModel.File); await Run(ProcessingModel.File.FullName, ProcessorUtil.GetOutputTmFullPath(ProcessingModel.File)); StatusBarProgressBar.Value++; StatusBarPercentage.Text = ProcessorUtil.GetPercentage(StatusBarProgressBar.Maximum, StatusBarProgressBar.Value) + "%"; } } finally { SetUICrap_EndProcessing(); } }
private void AddTmFileToGrid(FileInfo tmFileInfo) { if (IsInGrid(tmFileInfo)) { return; } var item = listViewMain.Items.Add(tmFileInfo.FullName); item.SubItems.Add(ProcessorUtil.GetOutputTmFullPath(tmFileInfo)); item.SubItems.Add("0%"); item.SubItems.Add("Waiting..."); item.Tag = new ProcessingModel { File = tmFileInfo }; }
private void SetUICrap_StartProcessing() { // yuk! quick 'n dirty feedback for UI textBoxMain.Text = string.Empty; textBoxMain.Text += "Start Processing\r\n"; textBoxMain.Text += DateTime.Now + "\r\n"; listViewMain.Enabled = false; toolStripMain.Enabled = false; aboutToolStripMenuItem.Enabled = false; StatusBarStatusLabel.Text = "Processing..."; StatusBarProgressBar.Value = 0; StatusBarProgressBar.Maximum = listViewMain.Items.Count; StatusBarPercentage.Text = ProcessorUtil.GetPercentage(StatusBarProgressBar.Maximum, StatusBarProgressBar.Value) + "%"; }
private void UpdateListViewItems(ProgressEventArgs e) { // yuk!!! should really look at a binding approach if (listViewMain.InvokeRequired) { listViewMain.Invoke(new MethodInvoker(delegate { listViewMain.Items[CurrentViewItem.Index].SubItems[2].Text = ProcessorUtil.GetPercentage(e.TotalUnits, e.CurrentProgress) + "%"; listViewMain.Items[CurrentViewItem.Index].SubItems[3].Text = ProcessorUtil.GetProgressMessage(e); })); } else { CurrentViewItem.SubItems[2].Text = ProcessorUtil.GetPercentage(e.TotalUnits, e.CurrentProgress) + "%"; CurrentViewItem.SubItems[3].Text = ProcessorUtil.GetProgressMessage(e); } }