-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
54 lines (47 loc) · 1.86 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
using Autofac;
using HgmViewer.Classes;
using HgmViewer.Service;
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace HgmViewer
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
log4net.Config.XmlConfigurator.Configure();
IContainer container = BuildContainer();
var scope = container.BeginLifetimeScope();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(scope.Resolve<HgmViewerForm>());
}
private static IContainer BuildContainer()
{
var builder = new ContainerBuilder();
builder.RegisterType<HgmViewerForm>();
builder.RegisterType<SetupControl>();
builder.RegisterType<SetupControl.SetupPage>();
builder.RegisterType<PackBrowserControl>();
builder.RegisterType<PackBrowserControl.PackBrowserPage>();
builder.RegisterType<ModelViewerControl>();
builder.RegisterType<ModelViewerControl.ModelViewerPage>();
builder.RegisterType<WebViewContext>();
builder.RegisterType<ApplicationService>().SingleInstance();
builder.RegisterType<ConfigService>().SingleInstance();
builder.RegisterType<PackService>().SingleInstance();
builder.RegisterType<ExportService>().SingleInstance();
builder.RegisterType<ViewerService>().SingleInstance();
var container = builder.Build();
return container;
}
}
}