-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathProgram.cs
More file actions
100 lines (80 loc) · 2.89 KB
/
Program.cs
File metadata and controls
100 lines (80 loc) · 2.89 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// -------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="MapWindow OSS Team - www.mapwindow.org">
// MapWindow OSS Team - 2016
// </copyright>
// -------------------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows.Forms;
// using MW5.Api.Concrete;
using MW5.DI.Castle;
using MW5.Helpers;
using MW5.Plugins.Mvp;
using MW5.Plugins.Services;
using MW5.Services.Concrete;
using MW5.Shared;
using MW5.Views;
// using MW5.DI.LightInject;
// using MW5.DI.Ninject;
// using MW5.DI.Unity;
namespace MW5
{
internal static class Program
{
public static Stopwatch Timer = new Stopwatch();
private static IApplicationContainer CreateContainer()
{
// Switch the class here and change the using directive above to use another one
// Also switch references.
// LightInjectContainer
// NinjectContainer
// UnityApplicationContainer
// return new NinjectContainer();
return new WindsorCastleContainer();
}
//private static void DumpFormats()
//{
// var manager = new DriverManager();
// manager.DumpExtensions(true);
// manager.DumpExtensions(false);
//}
private static void LoadConfig(IApplicationContainer container)
{
Logger.Current.Trace("Start LoadConfig");
MapInitializer.InitMapConfig();
Logger.Current.Trace("Before container.GetSingleton");
var configService = container.GetSingleton<IConfigService>();
Logger.Current.Trace("After container.GetSingleton");
configService.LoadAll();
Logger.Current.Trace("End LoadConfig");
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ExceptionHandler.Attach();
//DumpFormats();
var logger = new LoggingService();
logger.Info("APPLICATION STARTUP");
ShowSplashScreen();
Timer.Start();
var container = CreateContainer();
CompositionRoot.Compose(container);
SplashView.Instance.ShowStatus("Loading config");
LoadConfig(container);
SplashView.Instance.ShowStatus("Running application");
container.Run<MainPresenter>();
}
private static void ShowSplashScreen()
{
var splashScreen = SplashView.Instance;
splashScreen.ShowStatus("Composing DI container");
splashScreen.Show();
Application.DoEvents();
}
}
}