MainWindowViewModel.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using MyApp.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
namespace MyApp
{
public class MainWindowViewModel : ObservableRecipient
{
private string totalCost = "-.--";
public string TotalCost
{
get => totalCost;
set => SetProperty(ref totalCost, value);
}
private Restaurant restaurant;
public Restaurant Restaurant
{
get => restaurant;
set => SetProperty(ref restaurant, value);
}
private List<CustomerOrderItemViewModel> dishMenu;
public List<CustomerOrderItemViewModel> DishMenu
{
get => dishMenu;
set => SetProperty(ref dishMenu, value);
}
private void LoadDishMenu()
{
List<Dish> dishes = dataService.FindAllDishes();
DishMenu = new List<CustomerOrderItemViewModel>();
int i = 1;
foreach (Dish dish in dishes)
{
CustomerOrderItemViewModel item = new CustomerOrderItemViewModel
{
Dish = dish,
RowSerialNum = i
};
DishMenu.Add(item);
i += 1;
}
}
private void LoadRestaurant()
{
Restaurant = new Restaurant
{
Name = "Crazy大象旗舰店",
Address = "北京市朝阳区xxx路xxx号",
PhoneNumber = "010-1314520"
};
后面还有 74 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
