protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); /* * Below code will Register the application * */ var builder = new ContainerBuilder(); builder.RegisterModule<ApplicationRegistration>(); var container = builder.Build(); var app = container.Resolve<ApplicationViewModel>(); /* * SettingsService : Loading last saved settings. */ string settings = AutofacExample.EducationDepartment.Properties.Settings.Default.UISetting; _settingsService = container.Resolve<ISettingsService>(); if (!string.IsNullOrEmpty(settings)) { _settingsService.SetState(settings); } }