Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellWindow"/> class.
        /// </summary>
        public ShellWindow()
        {
            var serviceLocator = ServiceLocator.Default;

            InitializeComponent();

            serviceLocator.RegisterInstance(pleaseWaitProgressBar, "pleaseWaitService");

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

            statusService.Initialize(statusTextBlock);

            var dependencyResolver = this.GetDependencyResolver();
            var ribbonService      = dependencyResolver.Resolve <IRibbonService>();

            var ribbonContent = ribbonService.GetRibbon();

            if (ribbonContent != null)
            {
                ribbonContentControl.SetCurrentValue(ContentProperty, ribbonContent);
            }

            var statusBarContent = ribbonService.GetStatusBar();

            if (statusBarContent != null)
            {
                customStatusBarItem.SetCurrentValue(ContentProperty, statusBarContent);
            }

            var mainView = ribbonService.GetMainView();

            contentControl.Content = mainView;

            ShellDimensionsHelper.ApplyDimensions(this, mainView);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellWindow"/> class.
        /// </summary>
        public ShellWindow()
        {
            var serviceLocator = ServiceLocator.Default;

            var themeService = serviceLocator.ResolveType <IThemeService>();

            //ThemeHelper.EnsureApplicationThemes(GetType().Assembly, themeService.ShouldCreateStyleForwarders());

            InitializeComponent();

            serviceLocator.RegisterInstance(FooProgressMar, "pleaseWaitService");

            var statusService = serviceLocator.ResolveType <ICustomStatusService>();

            statusService.Initialize(statusTextBlock);

            var dependencyResolver = this.GetDependencyResolver();
            var ribbonService      = dependencyResolver.Resolve <IRibbonService>();

            var ribbonContent = ribbonService.GetRibbon();

            if (ribbonContent != null)
            {
                ribbonContentControl.SetCurrentValue(ContentProperty, ribbonContent);

                var ribbon = ribbonContent.FindVisualDescendantByType <Ribbon>();
                if (ribbon != null)
                {
                    serviceLocator.RegisterInstance <Ribbon>(ribbon);
                }
            }

            var statusBarContent = ribbonService.GetStatusBar();

            if (statusBarContent != null)
            {
                customStatusBarItem.SetCurrentValue(ContentProperty, statusBarContent);
            }

            var mainView = ribbonService.GetMainView();

            contentControl.Content = mainView;

            ShellDimensionsHelper.ApplyDimensions(this, mainView);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellWindow"/> class.
        /// </summary>
        public ShellWindow()
            : base(DataWindowMode.Custom, setOwnerAndFocus: false)
        {
            var serviceLocator = ServiceLocator.Default;

            InitializeComponent();

            statusBar.Background = Orc.Controls.ThemeHelper.GetAccentColorBrush(Orc.Controls.AccentColorStyle.AccentColor4);

            serviceLocator.RegisterInstance(pleaseWaitProgressBar, "pleaseWaitService");

            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>();
#pragma warning disable AvoidAsyncVoid // Avoid async void
                commandManager.RegisterAction("Help.About", async() => await aboutService.ShowAboutAsync());
#pragma warning restore AvoidAsyncVoid // Avoid async void
                aboutWindowCommand.SetCurrentValue(System.Windows.Controls.Primitives.ButtonBase.CommandProperty, commandManager.GetCommand("Help.About"));

                windowCommands.Items.Add(aboutWindowCommand);
            }

            RightWindowCommands = windowCommands;

            var statusBarContent = mahAppsService.GetStatusBar();
            if (statusBarContent != null)
            {
                customStatusBarItem.SetCurrentValue(ContentProperty, statusBarContent);
            }

            var mainView = mahAppsService.GetMainView();
            contentControl.Content = mainView;

            ShellDimensionsHelper.ApplyDimensions(this, mainView);

            SetBinding(TitleProperty, new Binding("ViewModel.Title")
            {
                Source = mainView
            });
        }