private void addRowMethod(object sender) { LastIndex++; EquationParametersViewModel newEquation = new EquationParametersViewModel(LastIndex + 1); newEquation.R = 1; EquationList.Add(newEquation); }
private void calculateMethod(object sender) { for (int i = 0; i < EquationList.Count; i++) { EquationParametersViewModel currentEquation = EquationList[i]; currentEquation.Result = (GRAVITATION_CONSTANT * currentEquation.M1 * currentEquation.M2) / Math.Pow(currentEquation.R, 2); } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataService dataService) { LastIndex = 0; EquationList = new ObservableCollection <EquationParametersViewModel>(); while (LastIndex < 3) { EquationParametersViewModel equation = new EquationParametersViewModel(LastIndex + 1); equation.R = 1; EquationList.Add(equation); LastIndex++; } LastIndex--; populateButtons(); }