Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellWindow"/> class.
        /// </summary>
        public ShellWindow()
        {
            ThemeHelper.EnsureApplicationThemes(GetType().Assembly, true);

            MahAppsHelper.ApplyTheme();

            InitializeComponent();

            var accentColorBrush = ThemeHelper.GetAccentColorBrush();

            border.BorderBrush = accentColorBrush;

            var serviceLocator = ServiceLocator.Default;
            var statusService  = serviceLocator.ResolveType <IStatusService>();

            statusService.Initialize(statusTextBlock);

            var commandManager = serviceLocator.ResolveType <ICommandManager>();
            var flyoutService  = serviceLocator.ResolveType <IFlyoutService>();
            var mahAppsService = serviceLocator.ResolveType <IMahAppsService>();

            serviceLocator.RegisterInstance <IAboutInfoService>(mahAppsService);

            var flyouts = new FlyoutsControl();

            foreach (var flyout in flyoutService.GetFlyouts())
            {
                flyouts.Items.Add(flyout);
            }

            Flyouts = flyouts;

            var windowCommands = mahAppsService.GetRightWindowCommands();

            if (mahAppsService.GetAboutInfo() != null)
            {
                var aboutWindowCommand = WindowCommandHelper.CreateWindowCommandButton("appbar_information", "about");

                var aboutService = serviceLocator.ResolveType <IAboutService>();
                commandManager.RegisterAction("Help.About", aboutService.ShowAbout);
                aboutWindowCommand.Command = commandManager.GetCommand("Help.About");

                windowCommands.Items.Add(aboutWindowCommand);
            }

            RightWindowCommands = windowCommands;

            var mainView = mahAppsService.GetMainView();

            contentControl.Content = mainView;

            SetBinding(TitleProperty, new Binding("ViewModel.Title")
            {
                Source = mainView
            });
        }
Esempio n. 2
0
 partial void OnCreatingShell()
 {
     MahAppsHelper.ApplyTheme();
 }