Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.Composition;
  4. using System.ComponentModel.Composition.Hosting;
  5. using System.ComponentModel.Composition.Primitives;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using Caliburn.Micro;
  11. using Caliburn.Micro.Telerik;
  12. using Telerik.Windows.Controls;
  13.  
  14. namespace SIMRS.SumberData.AdministarasiData
  15. {
  16. public class Bootstrapper : BootstrapperBase
  17. {
  18. private CompositionContainer container;
  19.  
  20. public Bootstrapper()
  21. {
  22. Initialize();
  23. }
  24. protected override void OnStartup(object sender, StartupEventArgs e)
  25. {
  26. DisplayRootViewFor<ShellViewModel>();
  27. }
  28.  
  29. protected override void Configure()
  30. {
  31. container = new CompositionContainer(
  32. new AggregateCatalog(
  33. AssemblySource
  34. .Instance.Select(x => new AssemblyCatalog(x))
  35. .OfType<ComposablePartCatalog>()));
  36.  
  37. var batch = new CompositionBatch();
  38.  
  39. batch.AddExportedValue<IWindowManager>(new TelerikWindowManager());
  40. batch.AddExportedValue<IEventAggregator>(new EventAggregator());
  41. batch.AddExportedValue(container);
  42.  
  43. // This is essential to enable Telerik's conventions
  44. TelerikConventions.Install();
  45.  
  46. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office_Black");
  47. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office_Blue");
  48. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office_Silver");
  49. //StyleManager.ApplicationTheme = ThemeManager.FromName("Summer");
  50. //StyleManager.ApplicationTheme = ThemeManager.FromName("Vista");
  51. //StyleManager.ApplicationTheme = ThemeManager.FromName("Windows8");
  52. //StyleManager.ApplicationTheme = ThemeManager.FromName("Windows8Touch");
  53. //StyleManager.ApplicationTheme = ThemeManager.FromName("Windows7");
  54. StyleManager.ApplicationTheme = ThemeManager.FromName("Expression_Dark");
  55. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office2013");
  56. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office2013_LightGray");
  57. //StyleManager.ApplicationTheme = ThemeManager.FromName("Office2013_DarkGray");
  58. //StyleManager.ApplicationTheme = ThemeManager.FromName("Transparent");
  59.  
  60. container.Compose(batch);
  61. }
  62.  
  63.  
  64. protected override IEnumerable<object> GetAllInstances(Type serviceType)
  65. {
  66. return container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType));
  67. }
  68.  
  69. protected override void BuildUp(object instance)
  70. {
  71. container.SatisfyImportsOnce(instance);
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement