You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
788 B

using System;
using Microsoft.Extensions.Logging;
using MyAvaloniaApp.Services;
using ReactiveUI;
namespace MyAvaloniaApp.ViewModels;
/// <summary>
/// 应用程序级别的 ViewModel,实现 IScreen 接口
/// </summary>
public class AppViewModel : ReactiveObject, IScreen
{
public RoutingState Router { get; }
public MainWindowViewModel MainWindowViewModel { get; }
public AppViewModel(
ILogger<MainWindowViewModel>? logger = null,
IDataService? dataService = null,
IResourceService? resourceService = null)
{
Router = new RoutingState();
// 使用依赖注入创建 MainWindowViewModel,传入自身作为 IScreen
MainWindowViewModel = new MainWindowViewModel(this, logger, dataService, resourceService);
}
}