58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using Prism.Ioc;
|
|
using Prism.Modularity;
|
|
using Prism.Unity;
|
|
using System.Windows;
|
|
using System.Windows.Threading;
|
|
using RIZO.Client.BLL;
|
|
using RIZO.Client.DAL;
|
|
using RIZO.Client.IBLL;
|
|
using RIZO.Client.IDAL;
|
|
using RIZO.Client.Start.Views;
|
|
|
|
namespace RIZO.Client.Start
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App : PrismApplication
|
|
{
|
|
protected override Window CreateShell()
|
|
{
|
|
return Container.Resolve<MainWindow>();
|
|
}
|
|
|
|
//这个方法会在应用程序初始化期间被自动调用
|
|
protected override void InitializeShell(Window shell)
|
|
{
|
|
// 先打开登录窗口,如果登录成功,则打开主窗口
|
|
// 阻塞调用线程 调用 ShowDialog() 后,代码执行会暂停,直到对话框关闭。这允许开发者在对话框关闭后根据用户的输入或选择采取相应的行动,
|
|
// 比如验证用户输入的数据或决定是否继续执行某些操作
|
|
|
|
if (Container.Resolve<LoginView>().ShowDialog() == false)
|
|
{
|
|
Application.Current?.Shutdown();
|
|
}
|
|
else
|
|
base.InitializeShell(shell);
|
|
}
|
|
|
|
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
|
{
|
|
containerRegistry.Register<Dispatcher>(() => Application.Current.Dispatcher);
|
|
|
|
containerRegistry.Register<ILoginDal, LoginDal>();
|
|
containerRegistry.Register<IUserDal, UserDal>();
|
|
|
|
containerRegistry.Register<ILoginBLL, LoginBLL>();
|
|
containerRegistry.Register<IUserBLL, UserBLL>();
|
|
}
|
|
|
|
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
|
|
{
|
|
// 可以改为自动扫描
|
|
moduleCatalog.AddModule<MainModule.MainModule>();
|
|
moduleCatalog.AddModule<BaseModule.BaseInfoModule>();
|
|
}
|
|
}
|
|
}
|