/// <summary> /// Append message to the appropriate text box. /// Messages are coming from an indexing progess delegete. /// </summary> /// <param name="msg">Text to display.</param> public void ShowMessage(string msg) { if (string.IsNullOrWhiteSpace(msg) || msg.Length < 1) { return; } lock (_progressLock) { var dt = DateTime.Now; var tmStr = dt.ToLongTimeString(); // get duration of previous action // if (!string.IsNullOrEmpty(UpdateProgressText.Text)) { TimeSpan ts = dt - _time; var duration = DurationString(ts); _time = dt; // append duration to the previous action // UpdateProgressText.AppendText(" DURATION: " + duration + Environment.NewLine); } // display current message // msg = tmStr + " : " + msg; UpdateProgressText.AppendText(msg); UpdateProgressText.ScrollToEnd(); UpdateProgressText.UpdateLayout(); } }
public UpdateWindow() { InitializeComponent(); maxticks = new UpdateMaxTicks(this.SetMaxTicks); newtick = new UpdateTick(this.ProgressTick); setstatus = new UpdateStatus(this.NewStatus); weredone = new CloseWindow(this.Done); newprogress = new UpdateProgressText(this.setspeed); addticks = new UpdateAddMaxTicks(this.AddMaxTicks); runthread = false; this.KeyPreview = true; }