public MainWindow()
        {
            InitializeComponent();
            Refresh_Ports(null, null);

#if MAZDA
            _cbt = new CanBusMazda3((string)PortList.SelectedItem);
#elif GENERIC
            _cbt = new CBTController((string)PortList.SelectedItem);
#else
            _cbt = new FakeCBT((string)PortList.SelectedItem);
#endif

            _buffer = new CanMessageBuffer(RECEIVE_BUFFER_SIZE);
            _timer  = new DispatcherTimer {
                IsEnabled = false, Interval = TimeSpan.FromMilliseconds(REFRESH_INTERVAL)
            };
            _timer.Tick += (sender, e) => { if (!_buffer.IsEmpty)
                                            {
                                                LoadDataGrid();
                                            }
            };
            Closing += MainWindow_Closing;

            BtConnect.IsChecked = BtFilter.IsChecked = BtSave.IsChecked = false;
            LoggingDisabled();
            DgLog.ItemsSource = new ObservableCollection <CanMessage>();

            _isViewChronological = true;
        }
        public MainWindow()
        {
            InitializeComponent();
            Refresh_Ports(null, null);
            _cbt = new CBTController((string)PortList.SelectedItem);            
            _buffer = new CanMessageBuffer(RECEIVE_BUFFER_SIZE);
            _timer = new DispatcherTimer { IsEnabled = false, Interval = TimeSpan.FromMilliseconds(REFRESH_INTERVAL)};
            _timer.Tick += (sender, e) => { if (!_buffer.IsEmpty) LoadDataGrid(); };
            Closing += MainWindow_Closing;

            BtConnect.IsChecked = BtFilter.IsChecked = BtSave.IsChecked = false;
            LoggingDisabled();
            DgLog.ItemsSource = new ObservableCollection<CanMessage>();
        }