Ejemplo n.º 1
0
        /// <summary>
        /// Initalize the lists.
        /// </summary>
        /// <param name="name"></param>
        public InputTerminalViewModel(string name)
        {
            base.DisplayName = name;

            _outputVM = IoC.Get <OutputDataViewModel>();

            _serialOptions = new SerialOptions();
            CommPortList   = SerialOptions.PortOptions;
            BaudRateList   = SerialOptions.BaudRateOptions;
            SelectedBaud   = 115200;

            GpsCommPortList   = SerialOptions.PortOptions;
            _gpsSerialOptions = new SerialOptions();
            SelectedGpsBaud   = 9600;

            StatusOutput = "";

            _adcpCodec = new AdcpCodec();
            _adcpCodec.ProcessDataEvent += _adcpCodec_ProcessDataEvent;

            // Scan for ADCP command
            ScanAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ScanAdcpCommand.Subscribe(_ => ScanForAdcp());

            // Disconnect Serial
            ConnectAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ConnectAdcpCommand.Subscribe(_ => ConnectAdcpSerial());

            // Disconnect Serial
            DisconnectAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            DisconnectAdcpCommand.Subscribe(_ => DisconnectAdcpSerial());

            // Scan for GPS command
            ScanGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ScanGpsCommand.Subscribe(_ => ScanForGps());

            // Disconnect Serial
            ConnectGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ConnectGpsCommand.Subscribe(_ => ConnectGpsSerial());

            // Disconnect Serial
            DisconnectGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            DisconnectGpsCommand.Subscribe(_ => DisconnectGpsSerial());

            // Start Pinging if not pinging
            StartPingingCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            StartPingingCommand.Subscribe(_ => StartPinging());

            // Stop Pinging if not pinging
            StopPingingCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            StopPingingCommand.Subscribe(_ => StopPinging());

            // Send the command to the ADCP
            SendAdcpCmdCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            SendAdcpCmdCommand.Subscribe(_ => SendAdcpCommand());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialize the ViewModel.
 /// </summary>
 public MainViewModel()
 {
     // Set the 2 ViewModels
     InputVM  = IoC.Get <InputTerminalViewModel>();
     OutputVM = IoC.Get <OutputDataViewModel>();
 }