예제 #1
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg, msg.name, msg.file, msg.function, msg.line);

            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
            {
                return;
            }
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                                                msg.level,
                                                msg.msg,
                                                msg.name,
                                                msg.file,
                                                msg.function,
                                                "" + msg.line);

            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);

                // remove any messages that are more than a minute NEWER than the JUST RECEIVED log message
                List <rosoutString> tooNew = rosoutdata.Where(s => s.stamp > rss.stamp + 60).ToList();
                if (tooNew.Count > 0)
                {
                    EDB.WriteLine("Dropping " + tooNew.Count + " rosout messages FROM THE FUTURE");
                }
                foreach (rosoutString rs in tooNew)
                {
                    rosoutdata.Remove(rs);
                }

                if (rosoutdata.Count > 1000)
                {
                    rosoutdata.RemoveAt(0);
                }
                abraCadabra.InvalidateMeasure();
                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                            {
                                abraCadabra.ScrollIntoView(rss);
                            }
                        }
                        else
                        {
                            Console.WriteLine("yay");
                        }
                    }
                }
            }));
        }
예제 #2
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg.data, msg.name.data, msg.file.data, msg.function.data, msg.line);

            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
            {
                return;
            }
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                                                msg.level,
                                                msg.msg.data,
                                                msg.name.data,
                                                msg.file.data,
                                                msg.function.data,
                                                "" + msg.line);

            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);
                if (rosoutdata.Count > 1000)
                {
                    rosoutdata.RemoveAt(0);
                }

                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                            {
                                abraCadabra.ScrollIntoView(rss);
                            }
                        }
                        else
                        {
                            Console.WriteLine("yay");
                        }
                    }
                }
            }));
        }
예제 #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
            {
                return;
            }
            abraCadabra.ItemsSource = rosoutdata;
            abraCadabra.LoadingRow += (o, a) => {
                rosoutString rs = a.Row.Item as rosoutString;
                a.Row.Background = Brushes.Black;
                a.Row.Foreground = Colorize(rs._level);
            };

            /* THESE LINES CAUSE THE NEWEST MESSAGE TO BE AT THE TOP. THE SORT CONTROLS SHOULD OVERRIDE THIS BEHAVIOR PER-VIEW LIFETIME. TODO: MAKE AN OPT-IN OPTION */
            abraCadabra.Items.SortDescriptions.Clear();
            abraCadabra.Items.SortDescriptions.Add(new SortDescription("stamp", ListSortDirection.Descending));
            abraCadabra.Items.Refresh();
        }
예제 #4
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                if (abraCadabra.Visibility != System.Windows.Visibility.Visible)
                {
                    abraCadabra.Visibility = System.Windows.Visibility.Visible;
                }
                string timestamp = DateTime.Now.ToShortTimeString() + "\n";
                string level     = ConvertVerbosityLevel(msg.level) + "\n";
                string msgdata   = msg.msg.data + "\n";
                string msgname   = msg.name.data + "\n";

                rosoutString rss = new rosoutString(timestamp, level, msgdata, msgname);
                rosoutdata.Add(rss);
                abraCadabra.ScrollIntoView(rss);

                //To prevent the list from getting too big, this cuts off old
                cleanList();
            }));
        }
예제 #5
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg.data, msg.name.data, msg.file.data, msg.function.data, msg.line);
            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
                return;
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                msg.level,
                msg.msg.data,
                msg.name.data,
                msg.file.data,
                msg.function.data,
                ""+msg.line);
            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);
                if (rosoutdata.Count > 1000)
                    rosoutdata.RemoveAt(0);

                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                                abraCadabra.ScrollIntoView(rss);
                        }
                        else Console.WriteLine("yay");
                    }
                }
            }));

        }
예제 #6
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg, msg.name, msg.file, msg.function, msg.line);
            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
                return;
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                msg.level,
                msg.msg,
                msg.name,
                msg.file,
                msg.function,
                ""+msg.line);
            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);

                // remove any messages that are more than a minute NEWER than the JUST RECEIVED log message
                List<rosoutString> tooNew = rosoutdata.Where(s => s.stamp > rss.stamp+60).ToList();
                if (tooNew.Count > 0)
                    EDB.WriteLine("Dropping " + tooNew.Count + " rosout messages FROM THE FUTURE");
                foreach (rosoutString rs in tooNew)
                    rosoutdata.Remove(rs);

                if (rosoutdata.Count > 1000)
                    rosoutdata.RemoveAt(0);
                abraCadabra.InvalidateMeasure();               
                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                                abraCadabra.ScrollIntoView(rss);
                        }
                        else Console.WriteLine("yay");
                    }
                }
            }));

        }