コード例 #1
0
        /// <summary>
        /// Method used to populate window information about Country Currency and Rates
        /// </summary>
        /// <param name="country"></param>
        private void SetRatesWindow(Country country)
        {
            tb_insertRate.IsReadOnly      = false;
            btnCalcRate.IsEnabled         = true;
            btnChangeRate.IsEnabled       = true;
            Rate_details.ItemsSource      = null;
            bt_deleteRateInsert.IsEnabled = true;
            var currency = country.Currencies;

            Rate_details.ItemsSource = null;
            Rate_details.ItemsSource = currency;
            List <CalcRate> CountryRate = new List <CalcRate>();

            CountryRate = Task.Run(() => UIData.ShowCountryRates(country, Rates)).Result;

            cb_ActiveCountryRate.DisplayMemberPath = "Name";
            List <CalcRate> allRates = new List <CalcRate>();

            allRates = Task.Run(() => UIData.ShowAllCoutryRates(country, Rates)).Result;
            if (CountryRate.Count == 0)
            {
                CountryRate.Add(new CalcRate
                {
                    Name = "Unavailable information",
                });
                cb_ActiveCountryRate.ItemsSource       = CountryRate;
                cb_ActiveCountryRate.DisplayMemberPath = "Name";
                tb_insertRate.IsReadOnly      = true;
                btnCalcRate.IsEnabled         = false;
                btnChangeRate.IsEnabled       = false;
                bt_deleteRateInsert.IsEnabled = false;
                allRates.Clear();
            }
            else
            {
                cb_ActiveCountryRate.ItemsSource       = CountryRate;
                cb_ActiveCountryRate.DisplayMemberPath = "Name";
            }

            if (allRates.Count == 0)
            {
                allRates.Add(new CalcRate
                {
                    Name = "Unavailable information",
                });
                cb_AllcountriesRate.ItemsSource       = allRates;
                cb_AllcountriesRate.DisplayMemberPath = "Name";
            }
            else
            {
                cb_AllcountriesRate.ItemsSource       = allRates;
                cb_AllcountriesRate.DisplayMemberPath = "Name";
            }
        }