public void Handle(WizardEvent <BudgetEquationWizardVM> message) { if (EquationToEdit != null && message.Status == WizardStatus.OK) { SuppressEvent = true; SaveEquation(message.Model.Equation); var equation = Equations.FirstOrDefault(x => x.Id == message.Model.Equation.Id); if (equation != null) { equation.Name = message.Model.Equation.Name; equation.IsVisible = message.Model.Equation.IsVisible; equation.Items.Clear(); equation.Items.AddRange(message.Model.Equation.Items); BudgetCalculatorEvaluator.Refresh(equation); equation.Refresh(); } else { Equations.Add(message.Model.Equation); } BudgetCalculatorEvaluator.Refresh(message.Model.Equation); SuppressEvent = false; } }
private void RefreshUI() { _suppressEvents = true; if (Model.CurrentItem == null) { Model.CreateDefaultCurrentItem(); SetToDefault(); } else if (!Model.Items.Contains(Model.CurrentItem)) { SetToDefault(); } else { var currentItem = Model.CurrentItem; bool isOperatorType = currentItem.ValueType == CalculatorValueType.Operator; bool isNoneOperatorType = currentItem.OperatorType == CalculatorOperatorType.None; IsLastElement = isOperatorType && isNoneOperatorType; SelectedOperatorType = currentItem.OperatorType; SelectedValueType = ValueTypes.FirstOrDefault(x => x.Value == currentItem.ValueType); SelectedCashFlow = CashFlows.FirstOrDefault(x => x.Id == currentItem.ForeignId); SelectedCashFlowGroup = CashFlowGroups.FirstOrDefault(x => x.Id == currentItem.ForeignId); SelectedIncome = Incomes.FirstOrDefault(x => x.Id == currentItem.ForeignId); SelectedSaving = Savings.FirstOrDefault(x => x.Id == currentItem.ForeignId); UserValue = currentItem.Value; UserText = currentItem.Text; SelectedEquation = Equations.FirstOrDefault(x => x.Id == currentItem.ForeignId); } NotifyOfPropertyChange(() => IsNoneOperatorSelected); NotifyOfPropertyChange(() => IsOperatorElementVisible); NotifyOfPropertyChange(() => IsAddOperatorSelected); NotifyOfPropertyChange(() => IsSubstractOperatorSelected); NotifyOfPropertyChange(() => IsMultiplyOperatorSelected); NotifyOfPropertyChange(() => IsDivideOperatorSelected); Title = string.Format("Składowe równania ({0}/{1})", Model.CurrentPageNumber, Model.TotalPagesNumber); _suppressEvents = false; }