/// <summary>
        /// Called when the VSPackage is loaded by Visual Studio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            //Set a uiculture
            //System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

            ObjectFactory.Configure(a =>
            {
                a.For<IAchievementRepository>().Singleton().Use<AppDataXmlCompletedAchievementsRepository>();
                a.For<ISettingsRepository>().Singleton().Use<AppDataXmlSettingsRepository>();
            });

            if (MenuService != null)
            {
                var menuCommandID = new CommandID(
                    GuidList.guidCSharpAchiever_Achiever_VSIXCmdSet,
                    (int)PkgCmdIDList.showAchievementIndex);

                var menuItem = new MenuCommand(MenuItemCallback, menuCommandID);

                MenuService.AddCommand(menuItem);
            }

            if (SolutionBuildManager != null)
            {
                var buildTracker = new BuildTracker(DTE);

                SolutionBuildManager.AdviseUpdateSolutionEvents(buildTracker, out updateSolutionEventsCookie);
            }

            AddService<IAchevementLibraryService>(this, true);

            RegisterAchievementAssembly(typeof(NRefactoryAchievement).Assembly);

            GuiInitializer.Initialize();

            AchievementContext.AchievementClicked += AchievementContext_AchievementClicked;
            DetectionDispatcher.DetectionCompleted += DetectionDispatcher_DetectionCompleted;
        }
        /// <summary>
        /// Called when the VSPackage is loaded by Visual Studio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            var preferredLocale = _settingsRepository.GetSettings().PreferredLocale;
            try
            {
                var cInfo = preferredLocale == string.Empty ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(preferredLocale);
                System.Threading.Thread.CurrentThread.CurrentUICulture = cInfo;
            }
            catch
            {
                //Ignored. This will throw if the culture in the settings repo isn't a valid culture.
            }

            if (MenuService != null)
            {
                var menuCommandID = new CommandID(
                    GuidList.guidCSharpAchiever_Achiever_VSIXCmdSet,
                    (int)PkgCmdIDList.showAchievementIndex);

                var menuItem = new MenuCommand(MenuItemCallback, menuCommandID);

                MenuService.AddCommand(menuItem);
            }

            if (SolutionBuildManager != null)
            {
                var buildTracker = new BuildTracker(DTE, _achievementService);

                SolutionBuildManager.AdviseUpdateSolutionEvents(buildTracker, out updateSolutionEventsCookie);
            }

            AddService<IAchievementLibraryService>(this, true);
            AddService(_achievementService, true);

            RegisterAchievementAssembly(typeof(NRefactoryAchievement).Assembly);

            AchievementUIContext.AchievementClicked += AchievementContext_AchievementClicked;
            _achievementService.StaticAnalysisCompleted += DetectionDispatcher_DetectionCompleted;
        }