添加主界面

This commit is contained in:
hsc
2026-01-14 15:19:16 +08:00
parent 72f3b855d8
commit 73e2cd8383
16 changed files with 868 additions and 38 deletions

View File

@@ -1,19 +1,21 @@
using LAEPS.ViewModels;
using Castle.DynamicProxy;
using Common;
using LAEPS.ViewModels;
using LAEPS.ViewModels.Dialogs;
using LAEPS.Views;
using LAEPS.Views.Dialogs;
using Castle.DynamicProxy;
using LAEPS.Views;
using LAEPS.Views.Dialogs;
using Logger;
using Notifications.Wpf.Core;
using ORM;
using Service.Implement;
using Service.Interface;
using System.Configuration;
using System.Data;
using System.Reflection;
using System.Windows;
using static System.Runtime.InteropServices.JavaScript.JSType;
using UIShare.PubEvent;
using Notifications.Wpf.Core;
using Logger;
using Common;
using ORM;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace LAEPS
{
@@ -69,6 +71,8 @@ namespace LAEPS
// 注册通知管理器
INotificationManager NotificationManager = new NotificationManager();
containerRegistry.RegisterInstance<INotificationManager>(NotificationManager);
// 注册服务
containerRegistry.RegisterSingleton<IPostService, PostService>();
}
//指定模块加载方式(需要手动将模块生成的dll放入Modules文件夹中)
protected override IModuleCatalog CreateModuleCatalog()
@@ -77,17 +81,16 @@ namespace LAEPS
return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
}
//手动模块加载方式
//protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
//{
// Type moduleAType = typeof(LoginModule.LoginModule);
// moduleCatalog.AddModule(new ModuleInfo()
// {
// ModuleName = moduleAType.Name,
// ModuleType = moduleAType.AssemblyQualifiedName,
// InitializationMode = InitializationMode.OnDemand
// });
// base.ConfigureModuleCatalog(moduleCatalog);
//}
}
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
Type moduleAType = typeof(MainModule.MainModule);
moduleCatalog.AddModule(new ModuleInfo()
{
ModuleName = moduleAType.Name,
ModuleType = moduleAType.AssemblyQualifiedName,
InitializationMode = InitializationMode.OnDemand
});
base.ConfigureModuleCatalog(moduleCatalog);
}
}
}

View File

@@ -41,12 +41,14 @@ namespace LAEPS.ViewModels
private IRegionManager _regionManager;
private IContainerProvider _containerProvider;
private INotificationManager _notificationManager;
private IModuleManager _moduleManager;
public ShellViewModel( IContainerProvider containerProvider)
{
_containerProvider= containerProvider;
_eventAggregator = containerProvider.Resolve<IEventAggregator>();
_regionManager = containerProvider.Resolve<IRegionManager>();
_notificationManager = containerProvider.Resolve<INotificationManager>();
_moduleManager = containerProvider.Resolve<IModuleManager>();
LeftDrawerOpenCommand = new DelegateCommand(LeftDrawerOpen);
MinimizeCommand = new DelegateCommand<Window>(MinimizeWindow);
MaximizeCommand = new DelegateCommand<Window>(MaximizeWindow);
@@ -65,6 +67,9 @@ namespace LAEPS.ViewModels
private void Load()
{
_notificationManager.ShowAsync(new NotificationContent { Title = "登录成功", Message = "", Type = NotificationType.Success });
//默认导航到主界面
Type moduleAType = typeof(MainModule.MainModule);
_moduleManager.LoadModule(moduleAType.Name);
}
private void Navigate(string content)
{