private void UpdateProgress(string text, bool isWorkIndicator = false) { if (string.IsNullOrEmpty(text) && !isWorkIndicator) { return; } Application.Current.Dispatcher.Invoke(new Action(() => { ProgressText = ProgressText.Replace(workIndicator, ""); if (isWorkIndicator) { workIndicator += "#"; if (workIndicator.Length > 80) { workIndicator = "###"; } ProgressText += workIndicator; TextBoxProgress.ScrollToEnd(); } else { ProgressText += DateTime.Now.ToString("HH:mm:ss") + ": " + text + Environment.NewLine; TextBoxProgress.ScrollToEnd(); workIndicator = "###"; } })); }
private void Bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { ProgressBarMain.Value = e.ProgressPercentage; if (e.UserState != null) { TextBoxProgress.AppendText(e.UserState.ToString() + Environment.NewLine); TextBoxProgress.ScrollToEnd(); } }