public void RefreshList()
        {
            var inUseCurrencies = IsoCurrencyCodes.AllCurrencies().Where(x => x.InUse == true).ToList();

            var currencyList = new List <CurrencySelectorItem>();

            foreach (var currencyUsed in inUseCurrencies)
            {
                currencyList.Add(new CurrencySelectorItem(currencyUsed.ISOCode));
            }
            this.Currencies = currencyList;
        }
Exemplo n.º 2
0
 public CurrencySelectorItem(string itemCurrency, CurrencyReporter Reporter = null)
 {
     if (Reporter?.Reporter == RporterType.Reverse)
     {
         this.Unit = "1 ";
     }
     Currency = itemCurrency;
     if (Reporter != null)
     {
         var inputCurrency  = IsoCurrencyCodes.AllCurrencies().ToList().SingleOrDefault(x => x.ISOCode == itemCurrency);
         var outputCurrency = IsoCurrencyCodes.AllCurrencies().ToList().SingleOrDefault(x => x.ISOCode == Reporter.Currency);
         this.ReporterValue = Math.Round(Reporter.Reporter == RporterType.Direct ? CurrencyHelper.GetCurrencyRate(outputCurrency, inputCurrency) :
                                         CurrencyHelper.GetCurrencyRate(inputCurrency, outputCurrency), 4);
     }
 }
        public CurrencyConversionViewModel()
        {
            this.AllCurrencies   = IsoCurrencyCodes.AllCurrencies().ToList();
            this.InUseCurrencies = AllCurrencies.Where(x => x.InUse == true).ToList();

            ResetDefaults();

            this.CurrencyInput.ValueChanged += InputCurrency;
            this.CurrencyInput.InputValue    = 1.00;

            this.CurrencyOutput.IsReadOnly      = true;
            this.SelectorFrom.Id                = FromSelector;
            this.SelectorFrom.SelectionChanged += SelectionChanged;

            this.SelectorTo.Id = ToSelector;
            this.SelectorTo.SelectionChanged += SelectionChanged;

            RevertCommand = new RelayCommand(this.Revert);

            Mediator.Instance.Register(this);
        }
        private void SetCurrencies()
        {
            var inCurrency  = this.SelectorFrom.CurrencySelected?.Currency;
            var outCurrency = this.SelectorTo.CurrencySelected?.Currency;

            this.CurrencyInput.CurrencySymbol  = inCurrency;
            this.CurrencyOutput.CurrencySymbol = outCurrency;

            this.FromCurrency = new CurrencySelectorItem(inCurrency);

            var currencyModelInpout  = CurrencyInfo(inCurrency);
            var currencyModelOutpout = CurrencyInfo(outCurrency);

            this.CurrencyInput.Description     = currencyModelInpout?.Currency;
            this.CurrencyOutput.Description    = currencyModelOutpout?.Currency;
            this.CurrencyInput.CurrencySymbol  = currencyModelInpout?.Symbol;
            this.CurrencyOutput.CurrencySymbol = currencyModelOutpout?.Symbol;

            this.CurrencyGrid.ReportToCurrency = new CurrencyReporter(inCurrency);
            this.LoadDate = IsoCurrencyCodes.LoadedDate();
        }