private void btnTrace_Click(object sender, RoutedEventArgs e) { System.Windows.Controls.Primitives.ToggleButton tButton = sender as System.Windows.Controls.Primitives.ToggleButton; if (tButton.IsChecked ?? false) { tButton.BorderThickness = new Thickness(4, 4, 4, 4); tButton.Padding = new Thickness(4, 4, 4, 4); btnTraceLabel2.Content = "Stop"; StartTrace(); } else { tButton.BorderThickness = new Thickness(1, 1, 1, 1); tButton.Padding = new Thickness(0, 0, 0, 0); btnTraceLabel2.Content = "Start"; if (TSpy == null) { TSpy = new pTracer.Tracers.TraceSpy(listview); } TSpy.Enabled = false; } }
public void StartTrace() { if (TSpy == null) { TSpy = new pTracer.Tracers.TraceSpy(listview); } // if filter is set if (FilterPID >= 0) { //MessageBox.Show("Set FilterPID: " + FilterPID); TSpy.FilterPID = FilterPID; } else { //MessageBox.Show("FilterPID < 0: " + FilterPID); } listview.ItemsSource = TSpy.Queue; ((System.Collections.Specialized.INotifyCollectionChanged)listview.ItemsSource).CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ListViewCollectionChanged); ((System.Collections.Specialized.INotifyCollectionChanged)listview.ItemsSource).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ListViewCollectionChanged); //TSpy.Start(); TSpy.StartReaderTask(); }