예제 #1
0
        /// <summary>
        /// Create a base view for all the Averaging Views.
        /// </summary>
        public AveragingBaseViewModel()
            : base("AvergingBaseViewModel")
        {
            // Project Manager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);

            // Initialize the dict
            _averagingVMDict = new ConcurrentDictionary <SubsystemDataConfig, AveragingViewModel>();

            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SimpleCompassCalWizardView)));

            // Back coommand
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Exit coommand
            ExitCommand = ReactiveCommand.Create();
            ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));
        }
        public DiagnosticsViewModel(SubsystemDataConfig config)
            : base("DiagnosticsViewModel")
        {
            // Set Subsystem
            _Config = config;

            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);

            // Get the Event Aggregator
            _events = IoC.Get <IEventAggregator>();

            _isProcessingBuffer = false;
            _buffer             = new ConcurrentQueue <DataSet.Ensemble>();

            _ensemble = new DataSet.Ensemble();

            // Close the VM
            CloseVMCommand = ReactiveCommand.Create();
            CloseVMCommand.Subscribe(_ => _events.PublishOnUIThread(new CloseVmEvent(_Config)));

            // Update the display
            _displayTimer           = new System.Timers.Timer(250);
            _displayTimer.Elapsed  += _displayTimer_Elapsed;
            _displayTimer.AutoReset = true;
            _displayTimer.Enabled   = true;
            _displayTimer.Start();

            Init();

            _events.Subscribe(this);
        }
예제 #3
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public ViewDataProfile3DViewModel(SubsystemDataConfig config)
            : base("3D Profile")
        {
            // Set Subsystem
            _Config = config;
            //_displayCounter = 0;

            // Get PulseManager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);

            // Get the Event Aggregator
            _events = IoC.Get <IEventAggregator>();

            _buffer = new ConcurrentQueue <DataSet.Ensemble>();

            // Initialize the thread
            _continue               = true;
            _eventWaitData          = new EventWaitHandle(false, EventResetMode.AutoReset);
            _processDataThread      = new Thread(ProcessDataThread);
            _processDataThread.Name = string.Format("3D Profile Plot View: {0}", config.DescString());
            _processDataThread.Start();

            // Get the options from the database
            GetOptionsFromDatabase();

            VelPlot = new Profile3DPlotViewModel();

            // Close the VM
            CloseVMCommand = ReactiveCommand.Create();
            CloseVMCommand.Subscribe(_ => _events.PublishOnUIThread(new CloseVmEvent(_Config)));

            // Register to receive data
            _events.Subscribe(this);
        }
        /// <summary>
        /// Create a base view for all the Graphical Views.
        /// </summary>
        public ViewDataBaseTextViewModel()
            : base("ViewDataBaseTextViewModel")
        {
            // Project Manager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);

            // Initialize the dict
            _textVMDict = new ConcurrentDictionary <SubsystemDataConfig, ViewDataTextViewModel>();

            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();
        }
예제 #5
0
        /// <summary>
        /// Create a base view for all the Graphical Views.
        /// </summary>
        public ViewDataBaseGraphicalViewModel()
            : base("ViewDataBaseGraphicalViewModel")
        {
            // Project Manager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);
            _isProcessingBuffer = false;
            _buffer             = new ConcurrentQueue <BulkEnsembleEvent>();

            // Initialize the dict
            _graphicalVMDict = new ConcurrentDictionary <SubsystemDataConfig, ViewDataGraphicalViewModel>();

            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();
        }
        /// <summary>
        /// Display the ensemble information.
        /// <param name="config">Configuration containing data source and SubsystemConfiguration.</param>
        /// </summary>
        public ViewDataTextEnsembleViewModel(SubsystemDataConfig config)
            : base("ViewDataTextEnsembleViewModel")
        {
            // Set Subsystem
            _Config = config;

            // Get PulseManager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);

            // Set GPS data default
            SetGpsDataDefault();

            // Update the display
            _displayTimer           = new System.Timers.Timer(500);
            _displayTimer.Elapsed  += _displayTimer_Elapsed;
            _displayTimer.AutoReset = true;
            _displayTimer.Enabled   = true;
        }
예제 #7
0
        /// <summary>
        /// Initialize the values.
        /// </summary>
        public DiagnosticsBaseViewModel()
            : base("Diagnostics Model")
        {
            // Initialize the values
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _adcpConn = IoC.Get <AdcpConnection>();
            _events   = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);

            // Initialize the dict
            _diagVMDict = new ConcurrentDictionary <SubsystemDataConfig, DiagnosticsViewModel>();

            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();

            Init();

            // Find ADCP command
            FindAdcpCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(_ => _._adcpConn,                                                     // Pass the AdcpConnection
                                                                           x => x.Value != null),                                                // Verify the Serial port is open
                                                              _ => Task.Run(() => FindAdcp()));                                                  // Start pinging
        }
예제 #8
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BackscatterViewModel(SubsystemDataConfig config)
            : base("Backscatter")
        {
            // Set Subsystem
            _Config = config;
            //_displayCounter = 0;

            // Get PulseManager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);

            // Get the Event Aggregator
            _events = IoC.Get <IEventAggregator>();

            _buffer = new ConcurrentQueue <DataSet.Ensemble>();

            // Initialize the thread
            _continue               = true;
            _eventWaitData          = new EventWaitHandle(false, EventResetMode.AutoReset);
            _processDataThread      = new Thread(ProcessDataThread);
            _processDataThread.Name = string.Format("Backscatter View: {0}", config.DescString());
            _processDataThread.Start();

            // Get the options from the database
            GetOptionsFromDatabase();

            AmpltiduePlot = new HeatmapPlotViewModel(HeatmapPlotSeries.HeatmapPlotType.Amplitude, _options.AmplitudeSeriesOptions);
            AmpltiduePlot.AddSeries(_options.AmplitudeSeriesOptions);
            AmpltiduePlot.UpdateOptionsEvent += AmplitudeVelPlot_UpdateOptionsEvent;

            // Close the VM
            CloseVMCommand = ReactiveCommand.Create();
            CloseVMCommand.Subscribe(_ => _events.PublishOnUIThread(new CloseVmEvent(_Config)));

            _events.Subscribe(this);
        }
        /// <summary>
        /// Create a base view for all the ScreenData Views.
        /// </summary>
        public ValidationTestBaseViewModel()
            : base("ValidationTestBaseViewModel")
        {
            // Project Manager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);
            _adcpConn = IoC.Get <AdcpConnection>();

            // Set if the user is an admin
            IsAdmin = Pulse.Commons.IsAdmin();
            //LakeTestDirectory = RTI.Pulse.Commons.GetProjectDefaultFolderPath() + @"\LakeTest";
            ValidationTestDirectory = Pulse.Commons.DEFAULT_RECORD_DIR;

            // Initialize the list
            _validationTestVMDict = new ConcurrentDictionary <SubsystemDataConfig, ValidationTestViewModel>();

            IsTesting     = _adcpConn.IsValidationTestRecording;
            IsTankTesting = false;

            // Setup Admin values
            SetupAdminValues();

            // Initialize for warning when not recording live data
            IsDisplayRecordingWarning = false;

            // Warning timer
            _warningRecordTimer           = new System.Timers.Timer();
            _warningRecordTimer.Interval  = 5000;               // 5 seconds.
            _warningRecordTimer.Elapsed  += _warningRecordTimer_Elapsed;
            _warningRecordTimer.AutoReset = true;

            // 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()));

            // Create a command to configure the ADCP for Fresh Water Lake Test
            ConfigureAdcpFreshCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => On_ConfigureAdcpFresh()));

            // Create a command to configure the ADCP for Salt Water Ocean Test
            ConfigureAdcpSaltCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => On_ConfigureAdcpSalt()));

            // Create a command to configure the ADCP for Tank Test
            ConfigureAdcpTankCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => On_ConfigureAdcpTank()));

            // Create a command to configure the ADCP for Ringing Test in tank
            ConfigureAdcpRingingTankCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => On_ConfigureAdcpRingingTank()));

            // Create a command to Start Pinging
            StartPingingCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => StartPingingCommandExec()));

            // Create a command to Stop Pinging
            StopPingingCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => StopPingingCommandExec()));

            // Import commands
            ImportAdcpScriptCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(_ => _._adcpConn,                                                // Pass the AdcpConnection
                                                                                   x => x.Value != null),                                           // Ensure the connection exist
                                                                      _ => ImportAdcpScript());                                                     // Import the ADCP Script


            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();
        }