コード例 #1
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize() {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            UIThread.EnsureService(this);

            _projectSystem = new ProjectSystemClient(DTE);

            CookiecutterTelemetry.Initialize();
        }
コード例 #2
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine("Entering Initialize() of: {0}".FormatInvariant(this));
            base.Initialize();

            UIThread.EnsureService(this);

            _projectSystem = new ProjectSystemClient(DTE);

            CookiecutterTelemetry.Initialize();
        }
コード例 #3
0
        private void ShowCookiecutterPage()
        {
            Debug.Assert(_cookiecutterPage == null);

            var outputWindow = OutputWindowRedirector.GetGeneral(this);

            Debug.Assert(outputWindow != null);

            ReportPrereqsEvent(true);

            string feedUrl = CookiecutterPackage.Instance.RecommendedFeed;

            if (string.IsNullOrEmpty(feedUrl))
            {
                feedUrl = UrlConstants.DefaultRecommendedFeed;
            }

            object commonIdeFolderPath;
            var    shell = (IVsShell)GetService(typeof(SVsShell));

            ErrorHandler.ThrowOnFailure(shell.GetProperty((int)__VSSPROPID.VSSPROPID_InstallDirectory, out commonIdeFolderPath));

            var gitClient           = GitClientProvider.Create(outputWindow, commonIdeFolderPath as string);
            var projectSystemClient = new ProjectSystemClient((EnvDTE80.DTE2)GetService(typeof(EnvDTE.DTE)));

            _cookiecutterPage = new CookiecutterContainerPage(
                this,
                outputWindow,
                CookiecutterTelemetry.Current,
                gitClient,
                new Uri(feedUrl),
                ExecuteCommand,
                projectSystemClient,
                UpdateCommandUI
                );
            _cookiecutterPage.ContextMenuRequested += OnContextMenuRequested;

            var projectLocation = _pendingNewSessionProjectLocation;

            _pendingNewSessionProjectLocation = null;

            _cookiecutterPage.InitializeAsync(CookiecutterPackage.Instance.CheckForTemplateUpdate, projectLocation).HandleAllExceptions(this, GetType()).DoNotWait();

            ((Frame)Content).Content = _cookiecutterPage;
        }
コード例 #4
0
        /////////////////////////////////////////////////////////////////////////////
        // Overriden Package Implementation
        #region Package Members

        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine("Entering {0}.InitializeAsync()".FormatInvariant(this));

            await base.InitializeAsync(cancellationToken, progress);

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            if (GetService(typeof(UIThreadBase)) == null)
            {
                ((IServiceContainer)this).AddService(typeof(UIThreadBase), new UIThread(JoinableTaskFactory), true);
            }

            CookiecutterTelemetry.Initialize();

            _projectSystem = new ProjectSystemClient(DTE);
            Trace.WriteLine("Leaving {0}.InitializeAsync()".FormatInvariant(this));
        }
コード例 #5
0
 public AddFromCookiecutterCommand(CookiecutterPackage package)
 {
     _package       = package;
     _projectSystem = new ProjectSystemClient(package.DTE);
 }