App.xaml.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Windows;
  7. using System.ComponentModel.Composition;
  8. using System.ComponentModel.Composition.Hosting;
  9. using WindowsPhone.Recipes.Push.Server.Services;
  10. using WindowsPhone.Recipes.Push.Server.ViewModels;
  11. namespace WindowsPhone.Recipes.Push.Server
  12. {
  13. /// <summary>
  14. /// Interaction logic for App.xaml
  15. /// </summary>
  16. public partial class App : Application
  17. {
  18. public CompositionContainer Container { get; private set; }
  19. protected override void OnStartup(StartupEventArgs e)
  20. {
  21. // Initialize MEF to export parts from current assembly.
  22. var catalog = new AssemblyCatalog(typeof(App).Assembly);
  23. Container = new CompositionContainer(catalog);
  24. Container.ComposeParts();
  25. // Create and show the main window where MainViewModel is the default source for data-binding.
  26. new MainWindow
  27. {
  28. DataContext = Container.GetExportedValue<MainViewModel>()
  29. }.Show();
  30. base.OnStartup(e);
  31. }
  32. }
  33. }