Example #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)));
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public ZeroPressureSensorViewModel()
            : base("Zero Pressure Sensor")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

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

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

            // Zero Pressure sensor command
            ZeroPressureSensorCommand = ReactiveCommand.Create();
            ZeroPressureSensorCommand.Subscribe(_ => ZeroPressureSensor());

            InitializeValue();
        }
Example #3
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public TimeViewModel()
            : base("ADCP Time")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Initialize the list
            TimeZoneList = new ReactiveList <AdcpTimeZoneOptions>();
            TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.LOCAL, "Local", true));
            TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.GMT, "GMT", false));

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

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

            // Local Date Time Command
            SetLocalDateTimeCommand = ReactiveCommand.Create();
            SetLocalDateTimeCommand.Subscribe(_ => SetLocalDateTime());

            // GMT Date Time Command
            SetGmtDateTimeCommand = ReactiveCommand.Create();
            SetGmtDateTimeCommand.Subscribe(_ => SetGmtDateTime());

            InitializeValue();
        }
Example #4
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public TemperatureViewModel()
            : base("Salinity")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


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

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

            // Salinity coommand
            SalinityCommand = ReactiveCommand.Create();
            SalinityCommand.Subscribe(param => OnSalinityCommand(param));

            InitializeValue();
        }
Example #5
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BottomTrackOnViewModel()
            : base("Bottom Track On")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            ConfigKey = "";

            // Create the list
            CreateList();

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

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

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MovingBoat());

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MonitoringAdcp());
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        /// <param name="config">AdcpSubsystemConfig for this view model.</param>
        /// <param name="configVM">Adcp Configuration view model.</param>
        public AdcpSubsystemConfigurationViewModel(AdcpSubsystemConfig config, AdcpConfigurationViewModel configVM)
            : base(string.Format("Subsystem Configuration {0}", config.ToString()))
        {
            ConfigKey = config.ToString();
            ConfigVM  = configVM;

            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the predictor from the selected project subsystem configuration
            // Create the VM
            //Predictor = config.Predictor as AdcpPredictor;
            //Predictor = _pm.SelectedProject.Configuration.SubsystemConfigDict[ConfigKey].Predictor as AdcpPredictor;
            CalcPrediction();
            RangeVM = new AdcpRangePlannerViewModel(PredictedProfileRange, PredictedBottomRange);

            // Update the properties with the latest values
            UpdateProperties();

            // Remove configuration command
            RemoveCommand = ReactiveCommand.Create();
            RemoveCommand.Subscribe(_ => OnRemoveCommand());

            // Edit the configuration command
            EditCommand = ReactiveCommand.Create();
            EditCommand.Subscribe(param => OnEditCommand(param));
        }
Example #7
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public FrequencyViewModel()
            : base("Frequency ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.SelectedSubsystem, x => x.Value != null));
            NextCommand.Subscribe(_ => OnNextCommand());

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

            FreqCommand = ReactiveCommand.Create();
            FreqCommand.Subscribe(param => AddConfig(param));

            // Set the possible subsystems
            SetSubsystems();
        }
Example #8
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);
        }
Example #9
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public ScanAdcpViewModel()
            : base("Scan ADCP")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Serial Number Generator view model
            SerialNumberGeneratorVM              = IoC.Get <SerialNumberGeneratorViewModel>();
            SerialNumberGeneratorVM.UpdateEvent += SerialNumberGeneratorVM_UpdateEvent;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsScanning, x => !x.Value));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ModeView)));

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

            // Scan ADCP command
            ScanAdcpCommand = ReactiveCommand.CreateAsyncTask(_ => ScanAdcp());

            InitializeValue();
        }
        /// <summary>
        /// Initialize the view.
        /// </summary>
        public DataFormatViewModel()
            : base("Data Format")
        {
            // Get objects
            _pm = IoC.Get <PulseManager>();

            // Initialize the options
            GetOptionsFromDatabase();
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public DeploymentReportDialogViewModel()
            : base("Deployment Report")
        {
            // Set Pulse Manager
            _pm = IoC.Get <PulseManager>();

            // Set Configuration
            Configuration = _pm.SelectedProject.Configuration;
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public AdcpConfigurationViewModel()
            : base("Adcp Configuration")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

            SubsystemConfigList = new ReactiveList <AdcpSubsystemConfigurationViewModel>();
            BatteryTypeList     = DeploymentOptions.GetBatteryList();

            // Initialize the values
            InitializeValues();

            // Scan ADCP command
            ScanAdcpCommand = ReactiveCommand.CreateAsyncTask(_ => ScanConfiguration());

            // Add Subsystem Configuration
            AddSubsystemCommand = ReactiveCommand.Create();
            AddSubsystemCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.FrequencyView)));

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsScanning, x => !x.Value));
            NextCommand.Subscribe(_ => NextPage());

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

            // Compass Cal coommand
            CompassCalCommand = ReactiveCommand.Create();
            CompassCalCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.CompassCalView)));

            // Edit the configuration command
            EditCommand = ReactiveCommand.Create();
            EditCommand.Subscribe(param => OnEditCommand(param));

            // Save the commands to a text file
            SaveCmdsCommand = ReactiveCommand.CreateAsyncTask(_ => SaveCommandsToFile());

            // Get the configuration from the project
            GetConfiguation();

            // Update the deployment duration to include all the new configurations
            // The duration needs to be divided amoung all the configuration
            UpdateDeploymentDuration();

            // Update the properites
            UpdateProperties();
        }
Example #13
0
        /// <summary>
        /// Initialize values.
        /// </summary>
        public ViewDataBaseViewModel()
        {
            // Project Manager
            _pm     = IoC.Get <PulseManager>();
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);
            _adcpConn = IoC.Get <AdcpConnection>();

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

            // Command to view the ViewData page
            HomeViewCommand = ReactiveCommand.Create();
            HomeViewCommand.Subscribe(_ => IoC.Get <IEventAggregator>().PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Command to view Graphical data
            GraphicalViewCommand = ReactiveCommand.Create();
            GraphicalViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseGraphicalViewModel>()));

            // Command to view Graphical data
            TextViewCommand = ReactiveCommand.Create();
            TextViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseTextViewModel>()));

            // Command to view DVL data
            DvlViewCommand = ReactiveCommand.Create();
            DvlViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseDvlViewModel>()));

            // Command to view Backscatter data
            BackscatterViewCommand = ReactiveCommand.Create();
            BackscatterViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseBackscatterViewModel>()));

            // Command to view 3D Profile data
            Profile3DViewCommand = ReactiveCommand.Create();
            Profile3DViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseProfile3DViewModel>()));

            // Command to view Diagnotics data
            DiagnosticViewCommand = ReactiveCommand.Create();
            DiagnosticViewCommand.Subscribe(_ => ActivateItem(IoC.Get <DiagnosticsBaseViewModel>()));

            // Command to view Diagnotics data
            ShipTrackViewCommand = ReactiveCommand.Create();
            ShipTrackViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ValidationTestBaseViewModel>()));

            // Display Graphical view by default
            ActivateItem(IoC.Get <ViewDataBaseGraphicalViewModel>());
        }
Example #14
0
        /// <summary>
        /// Initialize values.
        /// </summary>
        public DownloadDataViewModel()
            : base("DownloadDataViewModel")
        {
            // Update the display
            _displayTimer           = new System.Timers.Timer(500);
            _displayTimer.Elapsed  += _displayTimer_Elapsed;
            _displayTimer.AutoReset = true;
            _displayTimer.Enabled   = true;

            // Initialize values
            _adcpConn = IoC.Get <AdcpConnection>();
            _adcpConn.ReceiveDataEvent += new AdcpConnection.ReceiveDataEventHandler(_adcpConnection_ReceiveDataEvent);
            _pm = IoC.Get <PulseManager>();
            _eventAggregator = IoC.Get <IEventAggregator>();
            _eventAggregator.Subscribe(this);

            // Download values
            _isDownloadingData = false;
            DownloadTimeout    = DOWNLOAD_TIMEMOUT;
            DownloadTotalSpace = "";
            DownloadUsedSpace  = "";
            //DownloadDirectory = Pulse.Commons.GetProjectDefaultFolderPath();
            SetDownloadDirectory();
            _selectAllFiles        = true;
            OverwriteDownloadFiles = true;
            ParseDownloadedData    = false;
            DownloadFileList       = new ObservableCollectionEx <DownloadFile>();
            _downloadFailList      = new List <string>();
            _cancelDownload        = false;

            // Subscribe to recevie download events from the serial port and ethernet
            SubscribeDownloadEvents();

            // Create a wait handle to wait between each download
            _eventWaitDownload = new EventWaitHandle(false, EventResetMode.AutoReset);

            // Create a command to Download the data from the ADCP
            DownloadDataCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.CanDownloadData, x => x.Value),
                                                                  _ => Task.Run(() => DownloadData()));

            // Create a command to cancel the download process
            CancelDownloadCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.CanCancelDownload, x => x.Value),
                                                                    _ => Task.Run(() => CancelDownload()));

            // Create a command to populate the download list
            PopulateDownloadListCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.CanPopulateDownloadList, x => x.Value),
                                                                          _ => Task.Run(() => OnPopulateDownloadList()));

            // Create a command to format the SD card
            FormatSdCardCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.CanFormatSdCard, x => x.Value),
                                                                  _ => Task.Run(() => OnFormatSdCard()));
        }
        /// <summary>
        /// Initialize the view model with the water profile and bottom track
        /// current settings.
        /// </summary>
        /// <param name="wp">Water Profile Range.</param>
        /// <param name="bt">Bottom Track Range.</param>
        public AdcpRangePlannerViewModel(double wp, double bt) :
            base("AdcprangePlannerViewModel")
        {
            // Initialize the lines
            _pm = IoC.Get <PulseManager>();
            _waterProfileRange = wp;
            _bottomTrackRange  = bt;
            _wpBlank           = Commands.AdcpSubsystemCommands.DEFAULT_300_CWPBL;
            _btBlank           = Commands.AdcpSubsystemCommands.DEFAULT_300_CBTBL;
            _wpFirstBinRange   = 0.0;
            _depthToBottom     = Math.Max(_waterProfileRange, _bottomTrackRange);

            SetValues();
        }
        /// <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();
        }
Example #17
0
        /// <summary>
        /// Initialize the values.
        /// </summary>
        public ModeViewModel()
            : base("Mode")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            ModeOptionsList = new List <ModeOption>();
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.DirectReading)
            {
                TitleLine1 = "Direct", TitleLine2 = "Reading\n  Mode", Image = "../Images/SeaProfiler.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.SelfContained)
            {
                TitleLine1 = "Self", TitleLine2 = "Contained\n    Mode", Image = "../Images/SeaWatch.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.Waves)
            {
                TitleLine1 = "Waves", TitleLine2 = "Mode", Image = "../Images/SeaWave.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.River)
            {
                TitleLine1 = "River", TitleLine2 = "Mode", Image = "../Images/RiverProfiler.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.Dvl)
            {
                TitleLine1 = "DVL", TitleLine2 = "Mode", Image = "../Images/SeaPilot.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.VM)
            {
                TitleLine1 = "Vessel Mount", TitleLine2 = "Mode", Image = "../Images/SeaTrak.png"
            });

            // Get the Mode option
            GetSelectedModeOption();

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

            // 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)));
        }
Example #18
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;
        }
Example #20
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BinsViewModel()
            : base("Bins ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

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

            // 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)));
        }
Example #21
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        public WpMagDirOutputViewModel()
            : base("Water Profile Direction and Magnitude Data Output")
        {
            base.DisplayName = "Data Output";

            // Subscribe to receive ensembles
            _eventAggregator = IoC.Get <IEventAggregator>();
            _eventAggregator.Subscribe(this);

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

            _fileSizeMonitor = 0;

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

            FormatList = new List <string>();
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_SHIP);
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_EARTH);
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_INSTRUMENT);

            HeadingSourceList = Enum.GetValues(typeof(Transform.HeadingSource)).Cast <Transform.HeadingSource>().ToList();

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

            DataOutput = "";

            // Scan for ADCP command
            ScanCommand = ReactiveUI.ReactiveCommand.Create();
            ScanCommand.Subscribe(_ => ScanForSerialPorts());

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

            // Disconnect Serial
            DisconnectCommand = ReactiveUI.ReactiveCommand.Create();
            DisconnectCommand.Subscribe(_ => DisconnectSerial());
        }
Example #22
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public SaveAdcpConfigurationViewModel()
            : base("Save ADCP Configuration ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


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

            // 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)));
        }
    void Start()
    {
        localRotation = gameObject.transform.eulerAngles.y;
        timingDict    = new Dictionary <float, List <VertexManager> >();
        for (int i = -1; i <= GridManager.getYSegments(); i++)
        {
            timingDict[i] = new List <VertexManager>();
        }
        lastPlayedVertex = -1;
        objectPooler     = ObjectPooler.Instance;
        attachedObject   = gameObject;
        Vector3[] currentVerts = getVertices();
        drawVerts(currentVerts);
        GameObject objectPulseManager = GameObject.FindGameObjectWithTag("PulseManager");

        pulseManager = objectPulseManager.GetComponent <PulseManager>();
        chooseVoice();

        boxColliderManager = this.GetComponent <BoxColliderManager>();
        pulseManager.activateLineManager(this);
    }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public SimpleCompassCalWizardViewModel()
            : base("Simple Compass Cal Wizard")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => NextPage());

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

            InitializeValue();
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public LoadProjectsViewModel()
            : base("Load Projects")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Wait for decoding to be complete
            _eventWaitImport = new EventWaitHandle(false, EventResetMode.AutoReset);

            // Intialize values
            InitValues();

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.SelectedProjectVM, x => x.Value != null));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AdcpConfigurationView)));

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

            // Dialog to import data
            ImportDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportDataCommand.Subscribe(_ => ImportData());

            // Dialog to import RTB data
            ImportRtbDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportRtbDataCommand.Subscribe(_ => ImportRTB());

            // Scan for the projects
            Task.Run(() => ScanProjectAsync());
        }
Example #26
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public StorageViewModel()
            : base("Storage")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Initialize values
            IsLoading = false;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsNextAvail, x => x.Value));                           // Check if available
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SalinityView)));

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

            // Browse Project Folder command
            BrowseProjectFolderCommand = ReactiveCommand.Create();
            BrowseProjectFolderCommand.Subscribe(param => BrowseProjectFolder(param));

            // Refresh Internal ADCP storage coommand
            RefreshAdcpInternalStorageCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => CheckMemoryCard()));

            // Format SD Card
            FormatInternalStorageCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => FormatInternalStorage()));

            // Initialize values
            InitializeValues();
        }
Example #27
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public NewProjectViewModel()
            : base("New Project")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Serial Number Generator view model
            SerialNumberGeneratorVM = IoC.Get <SerialNumberGeneratorViewModel>();

            // Initialize the values
            _projectNameIndex  = 1;
            AdditionalCommands = "";

            // Get a default project name
            ProjectDir  = Pulse.Commons.GetProjectDefaultFolderPath();
            ProjectName = GetNewDefaultProjectName();

            // Load Project command
            LoadCommandsCommand = ReactiveCommand.Create();
            LoadCommandsCommand.Subscribe(_ => LoadCommands());

            // Browse Project Folder command
            BrowseProjectFolderCommand = ReactiveCommand.Create();
            BrowseProjectFolderCommand.Subscribe(_ => BrowseProjectFolder());

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => CreateProject());

            // 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)));
        }
Example #28
0
        /// <summary>
        /// Initialize the object with the project.
        /// </summary>
        /// <param name="project">Project for this VM.</param>
        /// <param name="vm">Load Project view model.</param>
        public ProjectListItemViewModel(Project project, LoadProjectsViewModel vm)
            : base(project.ProjectName)
        {
            // Initialize the project
            //_Project = project;
            ProjectName       = project.ProjectName;
            LastDateModified  = project.LastDateModified;
            ProjectFolderPath = project.ProjectFolderPath;
            _VM       = vm;
            _pm       = IoC.Get <PulseManager>();
            IsLoading = false;
            Task.Run(() => GetProjectImage(project));

            // Refresh the image command
            RefreshProjectImageCommand = ReactiveCommand.CreateAsyncTask(_ => RefreshProjectImage());

            // Delete the project command
            DeleteCommand = ReactiveCommand.Create();
            DeleteCommand.Subscribe(_ => DeleteProject());

            NumEnsembles = project.GetNumberOfEnsembles();
            GetFirstLastDate(project);
        }
Example #29
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
        }
Example #30
0
        /// <summary>
        /// Initialize the view.
        /// </summary>
        public DeployAdcpViewModel()
            : base("Deploy ADCP")
        {
            // Initialize values
            _events            = IoC.Get <IEventAggregator>();
            _pm                = IoC.Get <PulseManager>();
            _adcpConnection    = IoC.Get <AdcpConnection>();
            AdditionalCommands = "";
            IsLoading          = false;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsLoading, x => !x.Value));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

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

            // Exit command
            ExitCommand = ReactiveCommand.Create();
            ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Command to send commands to ADCP
            SendCommandsCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => ConfigureAdcp()));

            // Command to view all the commands
            ViewCommandsCommand = ReactiveCommand.Create();
            ViewCommandsCommand.Subscribe(_ => ShowCommands());

            // Command to zero pressure sensor
            ZeroPressureCommand = ReactiveCommand.Create();
            ZeroPressureCommand.Subscribe(_ => ZeroPressureSensor());

            // Save the commands to a text file
            SaveCmdsCommand = ReactiveCommand.Create();
            SaveCmdsCommand.Subscribe(_ => SaveCommandsToFile());
        }