Example #1
0
        private async Task LoadFundData()
        {
            if (Constants.isFundLoaded)
            {
                goto ReflectValue;
            }
            Constants.isFundLoaded = true;
            Funds.Clear();
            var funds = await _fundStore.GetFundsByUserId(Constants.curUserId);

            foreach (Fund fund in funds)
            {
                Funds.Add(new FundViewModel(fund));
            }

ReflectValue:
            if (Funds.Count != 0)
            {
                MyFundValue = Funds.Where(x => x.UserId == Constants.curUserId).Sum(x => x.Amount);
            }
            Constants.myTotalFund = (MyFundValue != 0) ? MyFundValue : 0;
            if (Constants.myTotalExpense != 0)
            {
                MyBalanceValue = MyFundValue - MyExpenseValue;
            }
        }