/// <summary>
        /// Initialize the values.
        /// </summary>
        public HomeViewModel()
        {
            // Set the list
            CommPortList = SerialOptions.PortOptions;
            BaudRateList = SerialOptions.BaudRateOptions;

            // Setup plot
            VelPlot = new BinPlot3D();
            VelPlot.CylinderRadius = 0;
            VelPlot.ColormapBrushSelection = ColormapBrush.ColormapBrushEnum.Jet;
            VelPlot.MinVelocity = Settings.Default.MinVelocity;
            VelPlot.MaxVelocity = Settings.Default.MaxVelocity;

            Legend = new ContourPlotLegendViewModel(VelPlot.ColormapBrushSelection, VelPlot.MinVelocity, VelPlot.MaxVelocity);

            PlotSize = Settings.Default.PlotSize;

            // Try to select any available comm ports
            if (!string.IsNullOrEmpty(Settings.Default.AdcpCommPort))
            {
                _SelectedAdcpCommPort = Settings.Default.AdcpCommPort;
                RaisePropertyChangedEventImmediately("SelectedAdcpCommPort");
            }
            else if (CommPortList.Count > 0)
            {
                _SelectedAdcpCommPort = CommPortList[0];
                RaisePropertyChangedEventImmediately("SelectedAdcpCommPort");
            }

            // Output Serial Port
            if (!string.IsNullOrEmpty(Settings.Default.OutputCommPort))
            {
                _SelectedOutputCommPort = Settings.Default.OutputCommPort;
                RaisePropertyChangedEventImmediately("SelectedOutputCommPort");
            }
            else if (CommPortList.Count > 1)
            {
                _SelectedOutputCommPort = CommPortList[1];
                RaisePropertyChangedEventImmediately("SelectedOutputCommPort");
            }

            // Get the latest baud rates
            _SelectedAdcpBaudRate = Settings.Default.AdcpBaud;
            _SelectedOutputBaudRate = Settings.Default.OutputBaud;
            RaisePropertyChangedEventImmediately("SelectedAdcpBaudRate");
            RaisePropertyChangedEventImmediately("SelectedOutputBaudRate");

            // Create the Serial options
            _adcpSerialOptions = new SerialOptions() { Port = SelectedAdcpCommPort, BaudRate = SelectedAdcpBaudRate };
            _outputSerialOptions = new SerialOptions() { Port = _SelectedOutputCommPort, BaudRate = SelectedOutputBaudRate };

            // Create codec to decode the data
            // Subscribe to process event
            _binaryCodec = new AdcpBinaryCodec();
            _binaryCodec.ProcessDataEvent += new AdcpBinaryCodec.ProcessDataEventHandler(_binaryCodec_ProcessDataEvent);

            // Initialize the list to accumulate a running average
            _runningAvgBuffer = new List<AvgData>();

            // Initialize output buffer
            _outputBuffer = new AvgDataBuffer();

            // Create the timer
            CreateTimer();

            // Try to connect the serial ports
            ConnectAdcp();
            ConnectOutputSerialPort();

            // Settings ViewModel
            SettingsVM = new SettingsViewModel(this);
        }
        /// <summary>
        /// Constructor
        /// Usings MEF dependency objects.
        /// </summary>
        /// <param name="vm">Get the view model through dependency objects.</param>
        public ContourPlotLegendView(ContourPlotLegendViewModel vm)
        {
            InitializeComponent();

            ViewModel = vm;
        }
        /// <summary>
        /// Constructor
        /// Usings MEF dependency objects.
        /// </summary>
        /// <param name="vm">Get the view model through dependency objects.</param>
        public ContourPlotLegendView(ContourPlotLegendViewModel vm)
        {
            InitializeComponent();

            ViewModel = vm;
        }