/App.xaml.cs
C# | 43 lines | 35 code | 5 blank | 3 comment | 0 complexity | 6807f8831b499ab3d12062c0ce224295 MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- using Login.ViewModel;
- using System.ComponentModel.Composition;
- using System.ComponentModel.Composition.Hosting;
- using Login.Helpers;
- using System.Reflection;
- using Login.Controllers;
- namespace Login
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- private AggregateCatalog catalog_;
- private CompositionContainer container_;
- private IEnumerable<IModuleController> moduleControllers_;
- protected override void OnStartup ( StartupEventArgs e )
- {
- base.OnStartup(e);
- catalog_ = new AggregateCatalog( );
- catalog_.Catalogs.Add(new AssemblyCatalog(typeof(Controller).Assembly));
- container_ = new CompositionContainer(catalog_);
- CompositionBatch batch = new CompositionBatch( );
- batch.AddExportedValue(container_);
- container_.Compose(batch);
- moduleControllers_ = container_.GetExportedValues<IModuleController>( );
- foreach ( var moduleController in moduleControllers_ ) { moduleController.Initialize( ); }
- foreach ( var moduleController in moduleControllers_ ) { moduleController.Run( ); }
- }
- }
- }