public void Refresh() { if (TargetObject == null) { return; } var o = TargetObject as IPortfolio; if (o == null) { return; } PositionList.Clear(); AccountList.Clear(); o.PositionList.ForEach(v => { PositionList.Add(v); }); o.AccountList.ForEach(v => { AccountList.Add(v); }); }
/// <summary> /// 获取朋友 /// </summary> /// <param name="nickname">昵称</param> public void GetFriends(string nickname = "1893888") { if (SearchWords != "") { nickname = SearchWords; } AccountList.Clear(); var client = APIHelper.GetNerbyFriendsAsync(nickname, pageNum, pageSize); client.UploadDataCompleted += OnSearchComplete;//指定回调 }
private void OnRefresh() { try { AccountList.Clear(); foreach (var account in Dal.GetAccounts()) { AccountList.Add(account); } OnPropertyChanged(nameof(AccountList)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Assets", MessageBoxButton.OK, MessageBoxImage.Error); } }
static public void SearchAccount(ComboBox box, TextBox search, HairSpaContext context) { IQueryable <Account> list = null; AccountList.Clear(); switch (box.SelectedItem) { case "Id": list = context.Accounts.Where(ac => ac.Id.ToString().Contains(search.Text)); break; case "Username": list = context.Accounts.Where(ac => ac.Username.Contains(search.Text)); break; default: break; } try { if (list.ToList().Count <= 0) { MessageBox.Show("No records were found", "No Results"); return; } else { list.ToList().ForEach(ac => AccountList.Add(ac)); } } catch (Exception) { MessageBox.Show("No records were found", "No Results"); return; } }