Exemplo n.º 1
0
        /// <summary>
        /// Constructs a new instance of this view model.
        /// </summary>
        /// <param name="paramController"></param>
        /// <param name="paramSummary"></param>
        internal ActualCashCalculatorViewModel(ISessionSummaryController paramController
                                               , Summary paramSummary)
        {
            this.m_controller = paramController;
            this.Summary      = paramSummary;

            List <Currency> currentCurrencies = new List <Currency>(Summary.AvailableCurrencies);

            currentCurrencies.Sort((x, y) => { return(y.IsDefault.CompareTo(x.IsDefault)); });

            DisplayCurrencies = new ObservableCollection <ActualCashCurrencyViewModel>();
            foreach (var currency in currentCurrencies)
            {
                var actualCashCurrency = new ActualCashCurrencyViewModel(this, currency);
                actualCashCurrency.PropertyChanged += new PropertyChangedEventHandler(actualCashCurrency_PropertyChanged);
                DisplayCurrencies.Add(actualCashCurrency);

                if (currency.IsDefault)
                {
                    DefaultCurrency = actualCashCurrency;
                }
            }

            ClearCommand = new RelayCommand((parameter) => OnClear());
            SaveCommand  = new RelayCommand((param) => m_controller.CloseCurrentView());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a new instance of this object
        /// </summary>
        /// <param name="actualCashCalculatorViewModel"></param>
        /// <param name="currency"></param>
        public ActualCashDenominationViewModel(ActualCashCurrencyViewModel parent
                                               , Denomination denom)
        {
            Parent  = parent;
            m_denom = denom;

            LoadFromSummary(Parent.Parent.Summary);
        }