Beispiel #1
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public AdcpUtilitiesViewModel()
            : base("ADCP Utilities")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();

            // Compass Cal command
            CompassCalCommand = ReactiveCommand.Create();
            CompassCalCommand.Subscribe(_ => CompassCal());

            // Compass Utility command
            CompassUtilityCommand = ReactiveCommand.Create();
            CompassUtilityCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.CompassUtilityView)));

            // Terminal command
            TerminalCommand = ReactiveCommand.Create();
            TerminalCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.TerminalView)));

            // Download command
            DownloadCommand = ReactiveCommand.Create();
            DownloadCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DownloadDataView)));

            // Upload Firmware command
            UploadCommand = ReactiveCommand.Create();
            UploadCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.UpdateFirmwareView)));

            // Screen data command
            ScreenCommand = ReactiveCommand.Create();
            ScreenCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScreenDataView)));

            VmOptionsCommand = ReactiveCommand.Create();
            VmOptionsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.VesselMountOptionsView)));

            // Predicition Model command
            PredicitionModelCommand = ReactiveCommand.Create();
            PredicitionModelCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AdcpPredictionModelView)));

            // RTI Compass Calibration Model command
            RtiCompassCalCommand = ReactiveCommand.Create();
            RtiCompassCalCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.RtiCompassCalView)));

            // Diagnostics View command
            DiagnosticsCommand = ReactiveCommand.Create();
            DiagnosticsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DiagnosticView)));

            // Data Output View command
            DataOutputCommand = ReactiveCommand.Create();
            DataOutputCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DataOutputView)));
        }
Beispiel #2
0
        /// <summary>
        /// Initalize values.
        /// </summary>
        public NavBarViewModel()
            : base("Nav")
        {
            _pm          = IoC.Get <PulseManager>();
            _events      = IoC.Get <IEventAggregator>();
            _adcpConn    = IoC.Get <AdcpConnection>();
            _IsRecording = false;
            this.NotifyOfPropertyChange(() => this.IsRecording);

            // Set the record image
            SetRecorderImage();

            // Warning timer
            _recorderTimer           = new System.Timers.Timer();
            _recorderTimer.Interval  = 2000;               // 2 seconds.
            _recorderTimer.Elapsed  += _recorderTimer_Elapsed;
            _recorderTimer.AutoReset = true;
            _recorderTimer.Start();

            // Command to go back a view
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Command to go to Home View
            HomeCommand = ReactiveCommand.Create();
            HomeCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Command to go to SmartPage View
            ConfigureCommand = ReactiveCommand.Create();
            ConfigureCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SmartPageView)));

            // Command to go to ViewData View
            ViewDataCommand = ReactiveCommand.Create();
            ViewDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

            //// Command to go to Playback data
            //PlaybackCommand = ReactiveCommand.Create();
            //PlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SelectPlaybackView)));

            // Select a file to playback
            PlaybackCommand = ReactiveCommand.Create();
            PlaybackCommand.Subscribe(_ => PlaybackFile());

            // Command to go to ScreenData View
            ScreenDataCommand = ReactiveCommand.Create();
            ScreenDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScreenDataView)));

            // Command to go to Project View
            ProjectCommand = ReactiveCommand.Create();
            ProjectCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ProjectView)));

            // Command to go to VesselMount Options View
            VmOptionsCommand = ReactiveCommand.Create();
            VmOptionsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.VesselMountOptionsView)));

            // Command to go to Data Format View
            DataFormatCommand = ReactiveCommand.Create();
            DataFormatCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DataFormatView)));

            // Command to go to VesselMount Options View
            AveragingCommand = ReactiveCommand.Create();
            AveragingCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView)));

            // Set the Clock time to Local System time on the ADCP
            StartTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => !x.Value),
                                                                  _ => Task.Run(() => On_StartTesting()));

            // Create a command to stop testing
            StopTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => x.Value),
                                                                 _ => Task.Run(() => On_StopTesting()));
        }