protected override void OnLoaded() { base.OnLoaded(); AmountMonitor.Default.MonitorCallBack += walletAmountData => { Application.Current.Dispatcher.Invoke(() => { CanUseMoney = walletAmountData.CanUseAmount; WaitMoney = walletAmountData.WaitAmount; TotalMoney = walletAmountData.TotalAmount; }); }; TradeRecodesMonitor.Default.MonitorCallBack += tradeRecords => { Application.Current.Dispatcher.Invoke(() => { if (tradeRecords.Count <= 5) { TradeRecords = tradeRecords; } else { TradeRecords.Clear(); tradeRecords.Take(5).ToList().ForEach(x => TradeRecords.Add(x)); } }); }; }
void OnScrollChanged(bool isdd) { StaticViewModel.GlobalViewModel.IsLoading = true; Task task = new Task(() => { var filterData = GetFilterCondition(); var tradeRecordsResult = OmniCoinService.Default.ListFilterTrans(filterData, TradeRecords.Count, true, 20); if (!tradeRecordsResult.IsFail) { Application.Current.Dispatcher.Invoke(() => { tradeRecordsResult.Value.ToList().ForEach(x => TradeRecords.Add(x)); }); } }); task.ContinueWith(t => { StaticViewModel.GlobalViewModel.IsLoading = false; }); task.Start(); }
void RefreshRecords(bool showLoading = true) { refreshTimer.Stop(); var count = TradeRecords.Count; if (count < 20) { count = 20; } if (showLoading) { StaticViewModel.GlobalViewModel.IsLoading = true; } Task task = new Task(() => { var filterData = GetFilterCondition(); var tradeRecordsResult = OmniCoinService.Default.ListFilterTrans(filterData, 0, true, count); if (!tradeRecordsResult.IsFail) { Application.Current.Dispatcher.Invoke(() => { TradeRecords.Clear(); tradeRecordsResult.Value.ToList().ForEach(x => TradeRecords.Add(x)); }); } }); task.ContinueWith(t => { if (showLoading) { StaticViewModel.GlobalViewModel.IsLoading = false; } _timerCount = 10; refreshTimer.Start(); }); task.Start(); }