public void PressCalculate() { if (this.IsCalcCommandLock) { return; } this.SetMemoryFieldValueByEvalInputText(this.MemoryFields.Get <double>(MemoryFieldNames.PostOperatorNumber)); double result = 0; if (this.ActiveMathOperator != MathOperator.None) { var(isValidResult, calculatedResult) = CalculationProxy.CalculateAndCheckResult( true, new Func <double, double, string, double>(BasicCalculations.Calculate), this.MemoryFields.Get <double>(MemoryFieldNames.PreOperatorNumber).Value, this.MemoryFields.Get <double>(MemoryFieldNames.PostOperatorNumber).Value, this.ActiveMathOperator.GetAttributeOfType <TokenAttribute>().Token); result = calculatedResult; } this.MemoryFields.Reset(new List <string>() { MemoryFieldNames.Categories.Standard }); this.MemoryFields.Get <double>(MemoryFieldNames.PreOperatorNumber).Value = result; this.InputText.SetInternalState(result); this.ActiveMathOperator = MathOperator.None; this.OutputText.SetResult(this.InputText.GetEvaluatedResult()); this.IsCalcCommandLock = true; this.InputText.Calculate(); }
public void CalculateYears() { this.DoCommonTasksIfLastCommandWasSpecial(); var(isValidResult, calculatedResult) = CalculationProxy.CalculateAndCheckResult( true, new Func <double, double, double, double, double, bool, double>(FinancialCalculation.N), this.MemoryFields.Get <double>(MemoryFieldNames.EndNumber).Value, this.MemoryFields.Get <double>(MemoryFieldNames.StartNumber).Value, this.MemoryFields.Get <double>(MemoryFieldNames.RateNumber).Value, this.MemoryFields.Get <double>(MemoryFieldNames.NominalInterestRateNumber).Value, this.MemoryFields.Get <int>(MemoryFieldNames.RatesPerAnnumNumber).Value, this.MemoryFields.Get <bool>(MemoryFieldNames.IsAdvance).Value); this.InputText.SetInternalState(calculatedResult); this.CommonSpecialFunctionWriteToMemoryOperations(this.MemoryFields.Get <double>(MemoryFieldNames.YearsNumber), 2); }
public static ICalculation Create() { ICalculation dynamicProxy = new CalculationProxy(); return(dynamicProxy); }