本文整理汇总了C#中ViewModel.FetchAll方法的典型用法代码示例。如果您正苦于以下问题:C# ViewModel.FetchAll方法的具体用法?C# ViewModel.FetchAll怎么用?C# ViewModel.FetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewModel
的用法示例。
在下文中一共展示了ViewModel.FetchAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveTransactionButton_Click
private void SaveTransactionButton_Click(object sender, RoutedEventArgs e)
{
Transaction newTransaction = new Transaction();
double amount;
string amountString = TransactionAmount.Text.Replace("$", "").TrimStart();
if (Double.TryParse(amountString, out amount))
{
newTransaction.Amount = amount;
}
string destinationString = ((ListItem)TransactionDestination.SelectedItem).Value;
int destination = int.Parse(destinationString);
newTransaction.DestinationAccount = destination;
newTransaction.IsRecurrent = false;
newTransaction.RecurrenceRule = null;
newTransaction.Notes = TransactionNotes.Text;
ViewModel<Transaction> transactionVM = new ViewModel<Transaction>();
transactionVM.Insert(newTransaction);
List<Transaction> transactions = transactionVM.FetchAll();
}
示例2: InitializeAccountItems
private void InitializeAccountItems()
{
ViewModel<Account> accountVM = new ViewModel<Account>();
List<Account> accounts = accountVM.FetchAll();
List<AccountsListItem> accountListItems = new List<AccountsListItem>(accounts.Count);
foreach (Account account in accounts)
{
accountListItems.Add(new AccountsListItem(account));
}
this.DefaultViewModel["Items"] = accountListItems;
}