/// <summary> /// Execute the scan of the ADCP. /// </summary> private void ExecuteScanAdcp() { if (_pm.IsProjectSelected) { _pm.SelectedProject = _adcpConnection.SetAdcpConfiguration(_pm.SelectedProject); } Application.Current.Dispatcher.BeginInvoke(new System.Action(() => { // Set the deployment days if it has changed //DeploymentDays = _pm.SelectedProject.Configuration.DeploymentOptions.Duration; if (_pm.SelectedProject.Configuration.DeploymentOptions.Duration <= 0) { DeploymentDays = 1.0; } else { DeploymentDays = _pm.SelectedProject.Configuration.DeploymentOptions.Duration; } // Clear the previous list and then populate it SubsystemConfigList.Clear(); // Create temp variables long dataSize = 0; double numberBattery = 0.0; foreach (AdcpSubsystemConfig ssCfg in _pm.SelectedProject.Configuration.SubsystemConfigDict.Values) { // Create the VM and add it to the list AdcpSubsystemConfigurationViewModel ssVM = new AdcpSubsystemConfigurationViewModel(ssCfg, this); //ssVM.Predictor.DeploymentDuration = _pm.SelectedProject.Configuration.DeploymentOptions.Duration; //ssVM.Predictor.BatteryType = _pm.SelectedProject.Configuration.DeploymentOptions.BatteryType; // Add the vm to the list SubsystemConfigList.Add(ssVM); // Calculate the prediction model ssVM.CalcPrediction(); // Accumluate the data sizes and number batteries for each subsystem configuration dataSize += ssVM.GetDataSize(); numberBattery += ssVM.NumberBatteryPacks; } // Update the deployment duration to include all the new configurations // The duration needs to be divided amoung all the configuration UpdateDeploymentDuration(); // Set the combined values NumberBatteryPacks = numberBattery.ToString("0.00"); PredictedStorageUsed = dataSize + InternalStorageUsed; DataSize = MathHelper.MemorySizeString(dataSize); UpdateProperties(); // Turn off flag IsScanning = false; })); }
/// <summary> /// Scan the ADCP for its configuration. /// </summary> private void ExecuteScanAdcp() { if (_pm.IsProjectSelected) { // Get the ADCP configuration _pm.SelectedProject = _adcpConnection.SetAdcpConfiguration(_pm.SelectedProject); // Set the serial number AdcpSerialNumber = _pm.SelectedProject.SerialNumber.ToString(); AdcpSerialNumber += "\n"; AdcpSerialNumber += _pm.SelectedProject.SerialNumber.GetSerialNumberDescString(true); // Set the serial number to the generator SerialNumberGeneratorVM.UpdateSerialNumber(_pm.SelectedProject.SerialNumber); // Turn off the flag IsScanning = false; } }