Ejemplo n.º 1
0
        /// <summary>
        /// Intialize the values for the view model.
        /// </summary>
        private void InitializeValues()
        {
            // If project is selected, initalize the values
            if (_pm.IsProjectSelected)
            {
                // Set the max file size but do not change it in the project
                _MaxFileSize = _pm.SelectedProject.GetMaxBinaryFileSize() / MathHelper.MB_TO_BYTES;
                this.NotifyOfPropertyChange(() => this.MaxFileSize);

                // Set the Disk1 folder path
                _Disk1FolderPath = _pm.SelectedProject.ProjectFolderPath;
                this.NotifyOfPropertyChange(() => this.Disk2FolderPath);

                _Disk2FolderPath = _pm.SelectedProject.BackupProjectFolderPath;
                this.NotifyOfPropertyChange(() => this.Disk2FolderPath);

                // Set if the disk is enabled based off if a value has been set for the path
                _IsDisk2Enabled = !string.IsNullOrEmpty(_Disk2FolderPath);
                this.NotifyOfPropertyChange(() => this.IsDisk2Enabled);

                // Internal recording
                if (_pm.SelectedProject.Configuration.Commands.CERECORD_EnsemblePing == Commands.AdcpCommands.AdcpRecordOptions.Enable || _pm.SelectedProject.Configuration.Commands.CERECORD_EnsemblePing == Commands.AdcpCommands.AdcpRecordOptions.BT_Eng)
                {
                    _IsInternalStorageEnabled = true;
                }
                else
                {
                    _IsInternalStorageEnabled = false;
                }
                this.NotifyOfPropertyChange(() => this.IsInternalStorageEnabled);

                // Memory card
                AdcpInternalStorageSize = MathHelper.MemorySizeString(_pm.SelectedProject.Configuration.DeploymentOptions.InternalMemoryCardTotalSize);
                AdcpInternalStorageUsed = MathHelper.MemorySizeString(_pm.SelectedProject.Configuration.DeploymentOptions.InternalMemoryCardUsed);

                // Set the product image
                ImageSrc = ProductImage.GetProductImage(_pm.SelectedProject);
            }
        }
        /// <summary>
        /// Update all the values based off new user input.
        /// </summary>
        private void SetValues()
        {
            // Adcp Image
            if (_pm.IsProjectSelected)
            {
                AdcpImage = ProductImage.GetProductImage(_pm.SelectedProject);
            }
            else
            {
                AdcpImage = DEFAULT_ADCP_IMAGE;
            }

            // Pulse lines
            WpBlankPos         = CalculatePosition(_wpBlank);
            BtBlankPos         = CalculatePosition(_btBlank);
            WpFirstBinRangePos = CalculatePosition(_wpFirstBinRange);

            // Calculate positions
            DepthToBottomPos     = CalculatePosition(_depthToBottom);
            WaterProfileRangePos = CalculatePosition(_waterProfileRange);
            BottomTrackRangePos  = CalculatePosition(_bottomTrackRange);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize the values.
        /// </summary>
        private void InitValues()
        {
            IsGps2Visible  = false;
            IsNmea1Visible = false;
            IsNmea2Visible = false;

            if (_pm.IsProjectSelected)
            {
                // Get the previous options if they have already been set
                SelectedAdcpCommPort = _adcpConnection.AdcpSerialPort.SerialOptions.Port;
                SelectedAdcpBaudRate = _adcpConnection.AdcpSerialPort.SerialOptions.BaudRate;

                // Set the selected projects GPS1 options to the last GPS1 options
                // Then make the connection
                if (_adcpConnection.Gps1SerialPort != null)
                {
                    _pm.SelectedProject.Configuration.Gps1SerialOptions = _adcpConnection.Gps1SerialPort.SerialOptions;
                    _SelectedGps1CommPort = _adcpConnection.Gps1SerialPort.SerialOptions.Port;
                    _SelectedGps1BaudRate = _adcpConnection.Gps1SerialPort.SerialOptions.BaudRate;
                    if (_adcpConnection.IsGps1SerialPortEnabled)
                    {
                        _adcpConnection.ReconnectGps1Serial(_pm.SelectedProject.Configuration.Gps1SerialOptions);
                    }
                }

                // Set the selected projects GPS2 options to the last GPS2 options
                // Then make the connection
                if (_adcpConnection.Gps2SerialPort != null)
                {
                    _pm.SelectedProject.Configuration.Gps2SerialOptions = _adcpConnection.Gps2SerialPort.SerialOptions;
                    _SelectedGps2CommPort = _adcpConnection.Gps2SerialPort.SerialOptions.Port;
                    _SelectedGps2BaudRate = _adcpConnection.Gps2SerialPort.SerialOptions.BaudRate;
                    if (_adcpConnection.IsGps2SerialPortEnabled)
                    {
                        _adcpConnection.ReconnectGps2Serial(_pm.SelectedProject.Configuration.Gps2SerialOptions);
                    }
                }

                // Set the selected projects Nmea1 options to the last Nmea1 options
                // Then make the connection
                if (_adcpConnection.Nmea1SerialPort != null)
                {
                    _pm.SelectedProject.Configuration.Nmea1SerialOptions = _adcpConnection.Nmea1SerialPort.SerialOptions;
                    _SelectedNmea1CommPort = _adcpConnection.Nmea1SerialPort.SerialOptions.Port;
                    _SelectedNmea1BaudRate = _adcpConnection.Nmea1SerialPort.SerialOptions.BaudRate;
                    if (_adcpConnection.IsNmea1SerialPortEnabled)
                    {
                        _adcpConnection.ReconnectNmea1Serial(_pm.SelectedProject.Configuration.Nmea1SerialOptions);
                    }
                }

                // Set the selected projects Nmea2 options to the last Nmea2 options
                // Then make the connection
                if (_adcpConnection.Nmea2SerialPort != null)
                {
                    _pm.SelectedProject.Configuration.Nmea2SerialOptions = _adcpConnection.Nmea2SerialPort.SerialOptions;
                    _SelectedNmea2CommPort = _adcpConnection.Nmea2SerialPort.SerialOptions.Port;
                    _SelectedNmea2BaudRate = _adcpConnection.Nmea2SerialPort.SerialOptions.BaudRate;
                    if (_adcpConnection.IsNmea2SerialPortEnabled)
                    {
                        _adcpConnection.ReconnectNmea2Serial(_pm.SelectedProject.Configuration.Nmea2SerialOptions);
                    }
                }

                // Set the product image
                AdcpImageSrc = ProductImage.GetProductImage(_pm.SelectedProject);

                // Based off mode, it will determine what is visible
                switch (_pm.SelectedProject.Configuration.DeploymentOptions.DeploymentMode)
                {
                case DeploymentOptions.AdcpDeploymentMode.VM:
                    IsGps2Visible  = true;
                    IsNmea1Visible = true;
                    IsNmea2Visible = true;
                    break;

                default:
                    IsGps2Visible  = false;
                    IsNmea1Visible = false;
                    IsNmea2Visible = false;
                    break;
                }
            }
        }