private void WebWatcherOnLogEntry(string text, int level) { Dispatcher.Invoke(new ThreadStart(delegate { LogBox.AppendParagraph(text.WrapTimeStamp(), ColorUtils.GetColorFromLevel(level)); })); }
private void WebWatcherOnNewFound(string text, int level) { Dispatcher.Invoke(new ThreadStart(delegate { SendToast(text); TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate; LogBox.AppendParagraph(text.WrapTimeStamp(), ColorUtils.GetColorFromLevel(level)); })); }
private async void TelegramLogWorker() { while (!_windowClosing) { if (_logQueue.Count > 0) { var t = _logQueue.Dequeue(); LogBox.AppendParagraph(t, Colors.Aquamarine); if (LogBox.Document.Blocks.Count > 200) { var toRemove = LogBox.Document.Blocks.ElementAt(0); LogBox.Document.Blocks.Remove(toRemove); } LogBox.ScrollToEnd(); } await Task.Delay(10); } }