Esempio n. 1
0
        private void DispatchedSaleaeEventHandler(SaleaeStringEventArgs e)
        {
            if (e is SeleaeWriteEventArgs)
            {
                tbMonitor.Inlines.Add(new Run("==== " + e.Timestamp.Subtract(connectedTime).ToString() + " ====\n")
                {
                    Foreground = Brushes.DarkRed
                });
                tbMonitor.Inlines.Add(new Run(e.Value + "\n")
                {
                    Foreground = Brushes.CornflowerBlue
                });
            }
            else if (e is SeleaeReadEventArgs)
            {
                tbMonitor.Inlines.Add(new Run(e.Value + "\n")
                {
                    Foreground = Brushes.Black
                });
            }

            // Purge very old lines
            while (tbMonitor.Inlines.Count > 300)
            {
                tbMonitor.Inlines.Remove(tbMonitor.Inlines.FirstInline);
            }
            scrollMonitor.ScrollToBottom();
        }
Esempio n. 2
0
 private void SaleaeEventHandler(Object sender, SaleaeStringEventArgs e)
 {
     this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                 (ThreadStart) delegate()
     {
         DispatchedSaleaeEventHandler(e);
     });
 }