PageRenderTime 37ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/App.xaml.cs

https://github.com/cmath/SimpleLoginManager
C# | 43 lines | 35 code | 5 blank | 3 comment | 0 complexity | 6807f8831b499ab3d12062c0ce224295 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using Login.ViewModel;
  9. using System.ComponentModel.Composition;
  10. using System.ComponentModel.Composition.Hosting;
  11. using Login.Helpers;
  12. using System.Reflection;
  13. using Login.Controllers;
  14. namespace Login
  15. {
  16. /// <summary>
  17. /// Interaction logic for App.xaml
  18. /// </summary>
  19. public partial class App : Application
  20. {
  21. private AggregateCatalog catalog_;
  22. private CompositionContainer container_;
  23. private IEnumerable<IModuleController> moduleControllers_;
  24. protected override void OnStartup ( StartupEventArgs e )
  25. {
  26. base.OnStartup(e);
  27. catalog_ = new AggregateCatalog( );
  28. catalog_.Catalogs.Add(new AssemblyCatalog(typeof(Controller).Assembly));
  29. container_ = new CompositionContainer(catalog_);
  30. CompositionBatch batch = new CompositionBatch( );
  31. batch.AddExportedValue(container_);
  32. container_.Compose(batch);
  33. moduleControllers_ = container_.GetExportedValues<IModuleController>( );
  34. foreach ( var moduleController in moduleControllers_ ) { moduleController.Initialize( ); }
  35. foreach ( var moduleController in moduleControllers_ ) { moduleController.Run( ); }
  36. }
  37. }
  38. }