forked from Particular/ServiceInsight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShellModule.cs
More file actions
71 lines (68 loc) · 3.82 KB
/
ShellModule.cs
File metadata and controls
71 lines (68 loc) · 3.82 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
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using Autofac;
using ExceptionHandler;
using ExceptionHandler.Settings;
using ExceptionHandler.Wpf;
using NServiceBus.Profiler.Desktop.Explorer;
using NServiceBus.Profiler.Desktop.Explorer.EndpointExplorer;
using NServiceBus.Profiler.Desktop.Explorer.QueueExplorer;
using NServiceBus.Profiler.Desktop.Options;
using NServiceBus.Profiler.Desktop.ScreenManager;
using NServiceBus.Profiler.Desktop.Search;
using NServiceBus.Profiler.Desktop.Shell;
using NServiceBus.Profiler.Desktop.Startup;
using NServiceBus.Profiler.Desktop.MessageFlow;
namespace NServiceBus.Profiler.Desktop.Modules
{
public class ShellModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterAssemblyTypes(ThisAssembly)
.Where(t => t.IsViewOrViewModel() && !ExcemptTypes.Contains(t))
.AsImplementedInterfaces()
.AsSelf()
.SingleInstance();
builder.RegisterSource(new SettingsSource());
builder.RegisterInstance(new AppCommandsWrapper()).As<IAppCommands>();
builder.RegisterType<QueueCreationView>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<ConnectToMachineView>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<LicenseRegistrationView>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<ServiceControlConnectionView>().AsImplementedInterfaces().InstancePerDependency();
builder.RegisterType<EndpointExplorerView>().As<IExplorerView>().InstancePerDependency();
builder.RegisterType<QueueExplorerView>().As<IExplorerView>().InstancePerDependency();
builder.RegisterType<EndpointExplorerViewModel>().AsImplementedInterfaces().SingleInstance();
builder.RegisterType<QueueExplorerViewModel>().AsImplementedInterfaces().SingleInstance();
builder.RegisterType<ShellViewModel>().As<IShellViewModel>().SingleInstance().PropertiesAutowired();
builder.RegisterType<ShellView>().As<IShellView>().SingleInstance().PropertiesAutowired();
builder.RegisterType<SearchBar>().As<ISearchBarView>().SingleInstance();
builder.RegisterType<StatusBarManager>().As<IStatusBarManager>().SingleInstance();
builder.RegisterType<AboutView>().InstancePerDependency().PropertiesAutowired();
builder.RegisterType<ScreenFactory>().As<IScreenFactory>().SingleInstance();
builder.RegisterType<DefaultExceptionHandler>().As<IExceptionHandler>().SingleInstance();
builder.RegisterType<ExceptionViewModel>().As<IExceptionViewModel>().InstancePerDependency();
builder.RegisterType<OptionsView>().As<IOptionsView>().InstancePerDependency();
builder.RegisterType<WpfClipboard>().As<IClipboard>().SingleInstance();
builder.RegisterType<SimpleSettingsReader>().As<ISettingsReader>().WithParameter(TypedParameter.From(ConfigurationManager.AppSettings));
builder.RegisterType<ExceptionDetailView>().AsImplementedInterfaces().InstancePerDependency();
}
protected static IEnumerable<Type> ExcemptTypes
{
get
{
yield return typeof (QueueCreationView);
yield return typeof (ConnectToMachineView);
yield return typeof (LicenseRegistrationView);
yield return typeof (ServiceControlConnectionView);
yield return typeof (OptionsView);
yield return typeof (ShellView);
yield return typeof (ExceptionView);
yield return typeof (AboutView);
yield return typeof (ExceptionDetailView);
}
}
}
}