Esempio n. 1
0
        private void LoadProvinces()
        {
            Provinces.Clear();

            IsLoadingCity = true;
            var action = new Action(() =>
            {
                var tempBanks = BankData.GetBanks();

                if (tempBanks != null)
                {
                    foreach (var item in tempBanks)
                    {
                        DispatcherHelper.UIDispatcher.Invoke(new Action <BankInfo>(Banks.Add), item);
                    }
                }
                //if (!isUpdate)
                SelectBank();

                var temp = CityData.GetAllState();
                if (temp != null)
                {
                    foreach (var item in temp)
                    {
                        DispatcherHelper.UIDispatcher.Invoke(new Action <CityModel>(Provinces.Add), item);
                    }
                }
                SelectProvince();
            });

            Task.Factory.StartNew(action).ContinueWith((task) =>
            {
                DispatcherHelper.UIDispatcher.Invoke(new Action(() =>
                {
                    IsLoadingCity = false;
                }));
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AddBankCardViewModel"/> class.
        /// </summary>
        public AddBankCardViewModel()
        {
            Banks = BankData.GetBanks();

            States = CityData.GetAllState();

            if (IsInDesignMode)
            {
                return;
            }

            isBusy = true;
            Action action = () => CommunicateManager.Invoke <IAccountService>(service =>
            {
                CashCompanyInfo = service.GetCompanyInfo();
            }, UIManager.ShowErr);

            Task.Factory.StartNew(action).ContinueWith(task =>
            {
                Action setAction = () => { IsBusy = false; };
                DispatcherHelper.UIDispatcher.Invoke(setAction);
            });
        }