private bool ChangeFFTChannelCode(SenseTimeDomainChannel channel, SummitSystem localSummit, SenseModel localSenseModel) { SummitSensing summitSensing = new SummitSensing(_log); if (localSummit != null && !localSummit.IsDisposed && localSenseModel != null) { try { if (!summitSensing.StopSensing(localSummit, false)) { return false; } localSenseModel.Sense.FFT.Channel = (int)channel; if (!summitSensing.StartSensingAndStreaming(localSummit, localSenseModel, false)) { return false; } } catch (Exception e) { _log.Error(e); return false; } } else { //error occurred return false; } return true; }
public MontageViewModel(ref SummitSystem theSummitLeft, ref SummitSystem theSummitRight, ILog _log, AppModel appModel) { this.theSummitLeft = theSummitLeft; this.theSummitRight = theSummitRight; this.isBilateral = appModel.Bilateral; this._log = _log; this.appModel = appModel; IsMontageEnabled = true; summitSensing = new SummitSensing(_log); jSONService = new JSONService(_log); stimParameterLeft = new StimParameterModel("", "", "", "", null); stimParameterRight = new StimParameterModel("", "", "", "", null); montageModel = jSONService.GetMontageModelFromFile(MONTAGE_FILEPATH); if (montageModel == null) { MessageBox.Show("The montage config file could not be read from the file. Please check that it exists.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } montageSweepConfigListLeft = montageSweepConfigListRight = LoadSenseJSONFilesForMontage(MONTAGE_BASEFILEPATH, MONTAGE_FILETYPE, montageModel); if (montageSweepConfigListLeft == null || montageSweepConfigListRight == null) { IsMontageEnabled = false; return; } //Get total time left and total time for montage. Display on progress bar timeLeftForMontage = totalTimeForMontage = GetTotalTimeForMontage(montageModel); TimeSpan time = TimeSpan.FromSeconds(timeLeftForMontage); //here backslash is must to tell that colon is //not the part of format, it just a character that we want in output string str = time.ToString(@"hh\:mm\:ss"); MontageTimeTextBox = "Total Montage Time: " + str; InstructionsTextBox = montageModel?.Instructions; }