// ------------------------------------- public void Recalculate() { try { if (EqPreviewVariables.Count > 0) { if (_bCalculating) return; _bCalculating = true; UpdateCalcInputs(); ClearResults(); CalcStatus calcStatus = _currentEquationCalc.CalculateAll(); IList<FunCalcError> lowestErrors = new List<FunCalcError>(); IList<FunCalcError> allErrors = new List<FunCalcError>(); _currentEquationCalc.GetErrors(ref lowestErrors, ref allErrors, NumberFormat: NumberFormat); if (lowestErrors?.Count > 0) { _errorMessage = lowestErrors[0].Message; } else { foreach (var item in EqPreviewVariables) { if (item.UnExpectedDimensions) { _errorMessage = "Unexpected Dimensions in variables or results"; } } } OnMessagesChanged(); RefreshEqPreviewVariables(); SetMaxUOMLength(); CalculationFinished?.Invoke(this, null); } } catch (Exception ex) { Logging.LogException(ex); throw; } finally { _bCalculating = false; } }
// ------------------------------------- public void Recalculate() { try { if (EqCalcVariables.Count > 0) { if (_bCalculating) { return; } _bCalculating = true; UpdateCalcInputs(); ClearResults(); CalcStatus calcStatus = CurrentEquationCalc.CalculateAll(); IList <FunCalcError> lowestErrors = new List <FunCalcError>(); IList <FunCalcError> allErrors = new List <FunCalcError>(); CurrentEquationCalc.GetErrors(ref lowestErrors, ref allErrors, NumberFormat: NumberFormat); if (lowestErrors?.Count > 0) { _errorMessage = lowestErrors[0].Message; } OnMessagesChanged(); RefreshEqCalcVariables(); SetMaxUOMLength(); CalculationFinished?.Invoke(this, null); } } catch (Exception ex) { Logging.LogException(ex); throw; } finally { _bCalculating = false; } }
/////////////////////////////////////////////////////////////////////////////// // Inherited methods // ///////////////////////////////////////////////////////////////// ///////////// #region OVERRIDES /// <summary> /// Initialize the delegates. /// </summary> protected override void InitializeCustomElements() { base.InitializeCustomElements(); this.writeConsoleLineDelegate = new WriteConsoleLine(this.WriteConsoleLineMethod); this.calculationFinishedDelegate = new CalculationFinished(this.CalculationFinishedMethod); // Remove this tab, because the options provided from ezvision // donĀ“t work well with still images. this.tacOptions.TabPages.Remove(this.tabOptions); string gazeDisplayModeFromSettings = this.cbbGazeDisplayMode.Text; this.cbbGazeDisplayMode.Items.AddRange(Enum.GetNames(typeof(FixationDrawingMode))); this.cbbGazeDisplayMode.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.cbbGazeDisplayMode.SelectedItem = gazeDisplayModeFromSettings; this.btnHelp.Click += new EventHandler(this.btnHelp_Click); this.pnlCanvas.Resize += new EventHandler(this.pnlCanvas_Resize); }