Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellService" /> class.
        /// </summary>
        /// <param name="typeFactory">The type factory.</param>
        /// <param name="keyboardMappingsService">The keyboard mappings service.</param>
        /// <param name="commandManager">The command manager.</param>
        /// <param name="splashScreenService">The splash screen service.</param>
        /// <param name="ensureStartupService">The ensure startup service.</param>
        /// <param name="applicationInitializationService">The application initialization service.</param>
        /// <param name="dependencyResolver">The dependency resolver.</param>
        /// <param name="serviceLocator">The service locator.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="typeFactory" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="keyboardMappingsService" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="commandManager" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="splashScreenService" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="applicationInitializationService" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="dependencyResolver" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceLocator" /> is <c>null</c>.</exception>
        public ShellService(ITypeFactory typeFactory, IKeyboardMappingsService keyboardMappingsService, ICommandManager commandManager,
                            ISplashScreenService splashScreenService, IEnsureStartupService ensureStartupService,
                            IApplicationInitializationService applicationInitializationService, IDependencyResolver dependencyResolver,
                            IServiceLocator serviceLocator)
        {
            Argument.IsNotNull(() => typeFactory);
            Argument.IsNotNull(() => keyboardMappingsService);
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => splashScreenService);
            Argument.IsNotNull(() => ensureStartupService);
            Argument.IsNotNull(() => applicationInitializationService);
            Argument.IsNotNull(() => dependencyResolver);
            Argument.IsNotNull(() => serviceLocator);

            _typeFactory                      = typeFactory;
            _keyboardMappingsService          = keyboardMappingsService;
            _commandManager                   = commandManager;
            _splashScreenService              = splashScreenService;
            _ensureStartupService             = ensureStartupService;
            _applicationInitializationService = applicationInitializationService;
            _dependencyResolver               = dependencyResolver;
            _serviceLocator                   = serviceLocator;

            var entryAssembly = Catel.Reflection.AssemblyHelper.GetEntryAssembly();

            Log.Info("Starting {0} v{1} ({2})", entryAssembly.Title(), entryAssembly.Version(), entryAssembly.InformationalVersion());

            // Initialize (now we have an application)
            DotNetPatchHelper.Initialize();
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Initializes the module.
    /// </summary>
    public static void Initialize()
    {
        var serviceLocator = ServiceLocator.Default;

        // Ensure that we are using the right culture
#pragma warning disable WPF0011 // Containing type should be used as registered owner.
        FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
                                                           new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
#pragma warning restore WPF0011 // Containing type should be used as registered owner.

        // Overide style of Catel please wait service
        serviceLocator.RegisterType <IPleaseWaitService, Orchestra.Services.PleaseWaitService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <IThirdPartyNoticesService, ThirdPartyNoticesService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <ICloseApplicationService, CloseApplicationService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IRecentlyUsedItemsService, RecentlyUsedItemsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IKeyboardMappingsService, KeyboardMappingsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusFilterService, StatusFilterService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusService, StatusService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <Orchestra.Services.ISplashScreenService, Orchestra.Services.SplashScreenService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <ICommandInfoService, CommandInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IManageAppDataService, ManageAppDataService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IEnsureStartupService, EnsureStartupService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAccentColorService, AccentColorService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutInfoService, AboutInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutService, AboutService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IClipboardService, ClipboardService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IBaseColorSchemeService, BaseColorSchemeService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IThemeService, ThemeService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IViewActivationService, ViewActivationService>();

        serviceLocator.RegisterType <IMessageService, Orchestra.Services.MessageService>();

        // Hints system
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>();
        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>();
        serviceLocator.RegisterType <IAdorneredTooltipsManager, AdorneredTooltipsManager>();
        serviceLocator.RegisterType <IHintsProvider, HintsProvider>();

        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipFactory, AdorneredTooltipFactory>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>(RegistrationType.Transient);

        // Custom views (sharing same view model)
        var uiVisualizerService = serviceLocator.ResolveType <IUIVisualizerService>();
        uiVisualizerService.Register <KeyboardMappingsCustomizationViewModel, KeyboardMappingsCustomizationWindow>(false);
        uiVisualizerService.Register <KeyboardMappingsOverviewViewModel, KeyboardMappingsOverviewWindow>(false);

        var thirdPartyNoticesService = serviceLocator.ResolveType <IThirdPartyNoticesService>();
        thirdPartyNoticesService.AddWithTryCatch(() => new ResourceBasedThirdPartyNotice("Catel", "https://www.catelproject.com", "Orchestra.Core", "Orchestra", "Resources.ThirdPartyNotices.catel.txt"));
        thirdPartyNoticesService.AddWithTryCatch(() => new ResourceBasedThirdPartyNotice("DotNetZip", string.Empty, "Orchestra.Core", "Orchestra", "Resources.ThirdPartyNotices.dotnetzip.txt"));
        thirdPartyNoticesService.AddWithTryCatch(() => new ResourceBasedThirdPartyNotice("Orchestra", "https://opensource.wildgums.com", "Orchestra.Core", "Orchestra", "Resources.ThirdPartyNotices.orchestra.txt"));
        thirdPartyNoticesService.AddWithTryCatch(() => new ResourceBasedThirdPartyNotice("Ricciolo", string.Empty, "Orchestra.Core", "Orchestra", "Resources.ThirdPartyNotices.ricciolo.txt"));

        var languageService = serviceLocator.ResolveType <ILanguageService>();
        languageService.RegisterLanguageSource(new LanguageResourceSource("Orchestra.Core", "Orchestra.Properties", "Resources"));

        DotNetPatchHelper.Initialize();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Initializes the module.
    /// </summary>
    public static void Initialize()
    {
        InitializeLogging();

        var serviceLocator = ServiceLocator.Default;

        // Overide style of Catel please wait service
        serviceLocator.RegisterType <IPleaseWaitService, Orchestra.Services.PleaseWaitService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <ICloseApplicationService, CloseApplicationService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IRecentlyUsedItemsService, RecentlyUsedItemsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IKeyboardMappingsService, KeyboardMappingsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusFilterService, StatusFilterService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusService, StatusService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <Orchestra.Services.ISplashScreenService, Orchestra.Services.SplashScreenService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <ICommandInfoService, CommandInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAppDataService, AppDataService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IEnsureStartupService, EnsureStartupService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutInfoService, AboutInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutService, AboutService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IClipboardService, ClipboardService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IThemeService, ThemeService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IViewActivationService, ViewActivationService>();

        serviceLocator.RegisterType <IMessageService, Orchestra.Services.MessageService>();

        // Hints system
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>();
        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>();
        serviceLocator.RegisterType <IAdorneredTooltipsManager, AdorneredTooltipsManager>();
        serviceLocator.RegisterType <IHintsProvider, HintsProvider>();

        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipFactory, AdorneredTooltipFactory>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>(RegistrationType.Transient);

        var uiVisualizerService = serviceLocator.ResolveType <IUIVisualizerService>();

        // Can be replaced by this in the future:
        //uiVisualizerService.Register<KeyboardMappingsCustomizationViewModel, KeyboardMappingsCustomizationWindow>(false);
        //uiVisualizerService.Register<KeyboardMappingsOverviewViewModel, KeyboardMappingsOverviewWindow>(false);

        if (!uiVisualizerService.IsRegistered(typeof(KeyboardMappingsCustomizationViewModel)))
        {
            uiVisualizerService.Register(typeof(KeyboardMappingsCustomizationViewModel).FullName, typeof(KeyboardMappingsCustomizationWindow));
        }

        if (!uiVisualizerService.IsRegistered(typeof(KeyboardMappingsOverviewViewModel)))
        {
            uiVisualizerService.Register(typeof(KeyboardMappingsOverviewViewModel).FullName, typeof(KeyboardMappingsOverviewWindow));
        }

        var languageService = serviceLocator.ResolveType <ILanguageService>();

        languageService.RegisterLanguageSource(new LanguageResourceSource("Orchestra.Core", "Orchestra.Properties", "Resources"));

        DotNetPatchHelper.Initialize();
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Initializes the module.
    /// </summary>
    public static void Initialize()
    {
        InitializeLogging();

        // Ensure that we are using the right culture
#pragma warning disable WPF0011 // Containing type should be used as registered owner.
        FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
                                                           new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
#pragma warning restore WPF0011 // Containing type should be used as registered owner.

        var serviceLocator = ServiceLocator.Default;

        // Overide style of Catel please wait service
        serviceLocator.RegisterType <IPleaseWaitService, Orchestra.Services.PleaseWaitService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <ICloseApplicationService, CloseApplicationService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IRecentlyUsedItemsService, RecentlyUsedItemsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IKeyboardMappingsService, KeyboardMappingsService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusFilterService, StatusFilterService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IStatusService, StatusService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <Orchestra.Services.ISplashScreenService, Orchestra.Services.SplashScreenService>();

        serviceLocator.RegisterTypeIfNotYetRegistered <ICommandInfoService, CommandInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAppDataService, AppDataService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IEnsureStartupService, EnsureStartupService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutInfoService, AboutInfoService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IAboutService, AboutService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IClipboardService, ClipboardService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IThemeService, ThemeService>();
        serviceLocator.RegisterTypeIfNotYetRegistered <IViewActivationService, ViewActivationService>();

        serviceLocator.RegisterType <IMessageService, Orchestra.Services.MessageService>();

        // Hints system
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>();
        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>();
        serviceLocator.RegisterType <IAdorneredTooltipsManager, AdorneredTooltipsManager>();
        serviceLocator.RegisterType <IHintsProvider, HintsProvider>();

        serviceLocator.RegisterType <IAdornerLayer, HintsAdornerLayer>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipFactory, AdorneredTooltipFactory>(RegistrationType.Transient);
        serviceLocator.RegisterType <IAdorneredTooltipsCollection, AdorneredTooltipsCollection>(RegistrationType.Transient);

        var uiVisualizerService = serviceLocator.ResolveType <IUIVisualizerService>();

        // Can be replaced by this in the future:
        //uiVisualizerService.Register<KeyboardMappingsCustomizationViewModel, KeyboardMappingsCustomizationWindow>(false);
        //uiVisualizerService.Register<KeyboardMappingsOverviewViewModel, KeyboardMappingsOverviewWindow>(false);

        if (!uiVisualizerService.IsRegistered(typeof(KeyboardMappingsCustomizationViewModel)))
        {
            uiVisualizerService.Register(typeof(KeyboardMappingsCustomizationViewModel).FullName, typeof(KeyboardMappingsCustomizationWindow));
        }

        if (!uiVisualizerService.IsRegistered(typeof(KeyboardMappingsOverviewViewModel)))
        {
            uiVisualizerService.Register(typeof(KeyboardMappingsOverviewViewModel).FullName, typeof(KeyboardMappingsOverviewWindow));
        }

        var languageService = serviceLocator.ResolveType <ILanguageService>();
        languageService.RegisterLanguageSource(new LanguageResourceSource("Orchestra.Core", "Orchestra.Properties", "Resources"));

        DotNetPatchHelper.Initialize();
    }