Exemple #1
0
        private void Filter_Click(object sender, EventArgs e)
        {
            useFilter = false;
            Filters   = new List <CompareBase> {
            };
            foreach (ToolStripItem child in viewToolStripMenuItem.DropDownItems)
            {
                string childTag = (string)child.Tag;
                if ((childTag != null) &&
                    (child.GetType() == typeof(ToolStripMenuItem)) &&
                    (((ToolStripMenuItem)child).Checked)
                    )
                {
                    useFilter |= true; Filters.Add(CompareBase.Create(childTag));
                }
            }
//            if (pGNsIDToolStripMenuItem.Checked) { useFilter |= true; Filters.Add(CompareBase.Create("ID")); }
//            if (sourceToolStripMenuItem.Checked) { useFilter |= true; Filters.Add(CompareBase.Create("Source")); }
//            if (instanceFieldsToolStripMenuItem.Checked) { useFilter |= true; Filters.Add(CompareBase.Create("InstanceFields")); }
//            if (enumFieldsToolStripMenuItem.Checked) { useFilter |= true; Filters.Add(CompareBase.Create("EnumFields")); }

            mnuShowAll.Checked = !useFilter;

            ResetFiltered();
        }
Exemple #2
0
        private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            string ColumnName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (Sorters.Count == 0)
            {
                // First click on any column; we simplky sort by this column
                Sorters.Add(CompareBase.Create(ColumnName));
            }
            else if (Sorters[0].Name == ColumnName)
            {
                // This is already main sort column; reverse its order
                Sorters[0].Sign *= -1;
            }
            else
            {
                // Delete any existing sorting on this column
                CompareBase comparer = Sorters.Find(delegate(CompareBase p) { return(p.Name == ColumnName); });
                if (comparer != null)
                {
                    Sorters.Remove(comparer);
                }
                Sorters.Insert(0, CompareBase.Create(ColumnName));
            }

            using (new WaitCursor())
            {
                int   oldIdx   = (dataGridView1.SelectedRows.Count > 0) ? dataGridView1.SelectedRows[0].Index : -1;
                Frame selFrame = (oldIdx >= 0 && oldIdx < DisplayedMsgs.Count) ? DisplayedMsgs[oldIdx] : null;
                dataGridView1.Rows[oldIdx].Selected = false;

                DisplayedMsgs.Sort(Sorter);

                if (selFrame != null)
                {
                    // Update grid row count
                    if (dataGridView1.RowCount != DisplayedMsgs.Count)
                    {
                        dataGridView1.RowCount = DisplayedMsgs.Count;
                    }

                    dataGridView1.Rows[DisplayedMsgs.IndexOf(selFrame)].Selected = true;
                }

                UpdateDisplay();
            }
        }
Exemple #3
0
        public DecodedLogForm(bool singleStreamMode)
        {
            InitializeComponent();

            maxFrames         = OpenSkipperApplication.Properties.Settings.Default.MaxFrames;
            txtMaxFrames.Text = maxFrames.ToString();

            PendingMsgs   = new List <Frame> {
            };
            DecodedMsgs   = new Queue <Frame> {
            };
            FilteredMsgs  = new List <Frame> {
            };
            DisplayedMsgs = new List <Frame> {
            };

            if (!singleStreamMode)
            {
                useFilter = false;
            }
            else
            {
                // Disable stream selection, we only have 1 stream in this mode.
                selectStreamsToolStripMenuItem.Enabled = false;

                firstShow            = false;
                fadeToShowMessageAge = false;
            }

            Filter_Click(this, null);
            // By default we filter by header and instance
//            uniqueHeadersAndEnumFieldsToolStripMenuItem.Checked = true;
//            useFilter = true;
//            Filters = new List<CompareBase> { CompareBase.Create("Header"), CompareBase.Create("EnumFields"), CompareBase.Create("InstanceFields") };

            // By default we sort by PGN
            Sorters = new List <CompareBase> {
                CompareBase.Create("ID")
            };
        }