public void Reload(int last) { var foo = _myRepository.GetNext(last); foreach (var item in foo) { MyDatas.Add(item); } }
/// <summary> /// 這裡是非同步函式,要回傳 Task,不要使用 void /// </summary> /// <param name="last"></param> public async Task Reload(int last) { Loading = true; var foo = _myRepository.GetNext(last); await Task.Delay(2000); foreach (var item in foo) { MyDatas.Add(item); } Loading = false; }