static void WriterMain() { for (int i = 0; i < 1000; ++i) { MMLog.Append(TraceEventType.Information, i, LogComponent.Client, "CMain", "Foo", String.Format("qwe {0}", i)); } s_exit = true; }
static void SpamMain() { int i = 0; while (s_exit == false) { MMLog.Append(TraceEventType.Information, 123, LogComponent.Client, "kala", "hdr", String.Format("qwe {0}", i++)); System.Threading.Thread.Sleep(1000); } }
void OnNewEntries() { if (this.Halt == true) { return; } var entries = MMLog.ReadNewEntries(m_logIndex, out m_logIndex); AddRange(entries); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); var conv = (LogEntryToBgBrushConverter)this.Resources["bgConverter"]; conv.Wnd = this; var dataView = CollectionViewSource.GetDefaultView(logListView.ItemsSource); dataView.Filter = DataFilter; OnNewEntries(); MMLog.RegisterChangeCallback(OnNewEntriesSafe); }
static void ReaderMain() { int sinceIdx = 0; int tick = 0; while (s_exit == false) { var entries = MMLog.ReadNewEntries(sinceIdx, out sinceIdx); for (int i = 0; i < entries.Length; ++i) { if (entries[i].Tick != tick) { throw new Exception(); } tick++; } } }
void OnNewEntriesSafe() { this.Dispatcher.BeginInvoke(new Action(OnNewEntries), System.Windows.Threading.DispatcherPriority.Background); MMLog.RegisterChangeCallback(OnNewEntriesSafe); }