private void updateTimeDisplay() { var dispStr = ""; var dispTime = new TimeSpan(DateTime.Now.Ticks - startTime); SearchIO.setTimeInterval(searchThread.ManagedThreadId, dispTime); if (dispTime.Days > 0) { dispStr += dispTime.Days + ","; } if (dispTime.Hours > 0) { dispStr += dispTime.Hours.ToString().PadLeft(2, '0') + ":"; } if (dispTime.Minutes > 0) { dispStr += dispTime.Minutes.ToString().PadLeft(2, '0') + ":"; } if (dispTime.TotalMilliseconds > 1) { lblTimeDisplay.Content = dispStr + dispTime.Seconds.ToString().PadLeft(2, '0') + "." + dispTime.Milliseconds.ToString().PadRight(3, '0'); } else { lblTimeDisplay.Content = "DD,hh:mm:ss.sss"; } }
void updateTimeDisplay() { SearchIO.setTimeInterval(searchThread.Name, new TimeSpan(DateTime.Now.Ticks - startTime)); this.timeDisplay.Text = SearchIO.getTimeInterval(searchThread.Name).ToString(); if (this.timeDisplay.Text.Length == 8) { this.timeDisplay.Text = this.timeDisplay.Text + ".000"; } else if (this.timeDisplay.Text.Length < 12) { this.timeDisplay.Text = this.timeDisplay.Text.PadRight(12, '0'); } if (this.timeDisplay.Text.StartsWith("00:")) { this.timeDisplay.Text = this.timeDisplay.Text.Substring(3, 9); } else { this.timeDisplay.Text = this.timeDisplay.Text.Substring(0, 11); this.timeText.Text = "time: (hh:mm:ss.ss):"; } }