/// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we *may* be on a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            // Otherwise, remove the switch to the UI thread if you don't need it.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            IVisualStudioServiceProvider serviceProvider = new VisualStudioServiceProvider(this);

            this.messageManager = new VisualStudioMessageManager();
            this.iOWrapper      = new IOWrapper();
            this.projectConfigurationManager = new ProjectConfigurationManager(this.messageManager);
            this.vsPackageWrapper            = new VsPackageWrapper();
            this.projectManager   = new ProjectManager(serviceProvider, iOWrapper, vsPackageWrapper, messageManager, projectConfigurationManager);
            this.authManager      = new AuthenticationManager(messageManager, projectManager);
            this.arasDataProvider = new ArasDataProvider(authManager, messageManager);
            this.dialogFactory    = new DialogFactory(authManager, arasDataProvider, serviceProvider, iOWrapper, messageManager);
            ICodeFormatter codeFormatter = new VisualStudioCodeFormatter(this.projectManager);

            this.codeProviderFactory = new CodeProviderFactory(codeFormatter, messageManager, iOWrapper);
            this.globalConfiguration = new GlobalConfiguration(iOWrapper);
            this.projectUpdater      = new ProjectUpdater(this.iOWrapper);
            this.eventListener       = new EventListener(projectManager, projectUpdater, projectConfigurationManager, iOWrapper);
            this.openContextParser   = new OpenContextParser();
            this.methodOpener        = new MethodOpener(projectManager, dialogFactory, openContextParser, messageManager);

            Commands.OpenFromArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, globalConfiguration, messageManager);
            Commands.SaveToArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.UpdateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ConnectionInfoCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.CreateCodeItemCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.RefreshConfigCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.MoveToCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ImportOpenInVSActionCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);

            this.eventListener.StartListening();

            IVsAppCommandLine cmdLine = await GetServiceAsync(typeof(SVsAppCommandLine)) as IVsAppCommandLine;

            ErrorHandler.ThrowOnFailure(cmdLine.GetOption(OpenInVSConstants.ProtocolName, out int isPresent, out string openMethodRequest));
            if (isPresent == 1)
            {
                methodOpener.OpenMethodFromAras(openMethodRequest);
            }
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // When initialized asynchronously, we *may* be on a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            // Otherwise, remove the switch to the UI thread if you don't need it.
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            IVisualStudioServiceProvider serviceProvider = new VisualStudioServiceProvider(this);

            this.messageManager = new VisualStudioMessageManager();
            this.iOWrapper      = new IOWrapper();
            this.projectConfigurationManager = new ProjectConfigurationManager();
            this.vsPackageWrapper            = new VsPackageWrapper();
            this.projectManager   = new ProjectManager(serviceProvider, iOWrapper, vsPackageWrapper, messageManager, projectConfigurationManager);
            this.authManager      = new AuthenticationManager(messageManager, projectManager);
            this.arasDataProvider = new ArasDataProvider(authManager, messageManager);
            this.dialogFactory    = new DialogFactory(authManager, arasDataProvider, serviceProvider, iOWrapper, messageManager);
            ICodeFormatter codeFormatter = new VisualStudioCodeFormatter(this.projectManager);

            this.codeProviderFactory = new CodeProviderFactory(codeFormatter, messageManager, iOWrapper);
            this.globalConfiguration = new GlobalConfiguration(iOWrapper);

            Commands.OpenFromArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.OpenFromPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.CreateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, globalConfiguration, messageManager);
            Commands.SaveToArasCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.SaveToPackageCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.UpdateMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.ConnectionInfoCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.CreateCodeItemCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.RefreshConfigCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, messageManager);
            Commands.DebugMethodCmd.Initialize(projectManager, authManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);
            Commands.MoveToCmd.Initialize(projectManager, dialogFactory, projectConfigurationManager, codeProviderFactory, messageManager);

            var dte = (DTE)serviceProvider.GetService(typeof(DTE));

            this.projectItemsEvents = dte.Events.GetObject("CSharpProjectItemsEvents") as ProjectItemsEvents;
            if (this.projectItemsEvents != null)
            {
                this.projectItemsEvents.ItemRemoved += this.ProjectItemsEvents_ItemRemoved;
                this.projectItemsEvents.ItemRenamed += this.ProjectItemsEvents_ItemRenamed;
            }
        }