SH: recovery
This commit is contained in:
43
StructureHelper/App.xaml.cs
Normal file
43
StructureHelper/App.xaml.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using System.Windows;
|
||||
using Autofac;
|
||||
|
||||
namespace StructureHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public static IContainer Container { get; private set; }
|
||||
public static ILifetimeScope Scope { get; private set; }
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<PrimitiveRepository>().As<IPrimitiveRepository>().SingleInstance();
|
||||
builder.RegisterType<UnitSystemService>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<CalculationService>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<MainModel>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<MainViewModel>().AsSelf().SingleInstance();
|
||||
|
||||
builder.RegisterType<MainView>().AsSelf();
|
||||
|
||||
Container = builder.Build();
|
||||
Scope = Container.Resolve<ILifetimeScope>();
|
||||
|
||||
var window = Scope.Resolve<MainView>();
|
||||
window.Show();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
Scope.Dispose();
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user