Example #1
0
        public async Task InitializeAsync(bool checkForUpdates, CookiecutterSessionStartInfo ssi)
        {
            if (ssi?.ExistingProjectTarget != null)
            {
                ViewModel.FixedOutputFolder     = true;
                ViewModel.TargetProjectLocation = ssi.ExistingProjectTarget;
                ViewModel.OutputFolderPath      = ssi.ExistingProjectTarget.FolderPath;
                ViewModel.ProjectName           = string.Empty;
            }
            else if (ssi?.NewProjectFolderPath != null)
            {
                ViewModel.FixedOutputFolder     = true;
                ViewModel.TargetProjectLocation = null;
                ViewModel.OutputFolderPath      = ssi.NewProjectFolderPath;
                ViewModel.ProjectName           = ssi.NewProjectName;
            }
            else
            {
                ViewModel.FixedOutputFolder     = false;
                ViewModel.TargetProjectLocation = null;
                ViewModel.OutputFolderPath      = string.Empty;
                ViewModel.ProjectName           = string.Empty;
            }

            ViewModel.SearchTerm = string.Empty;
            await ViewModel.SearchAsync(ssi?.TemplateUri);

            CommandManager.InvalidateRequerySuggested();

            if (checkForUpdates)
            {
                _checkForUpdatesTimer.Interval = CheckForUpdateInitialDelay;
                _checkForUpdatesTimer.Start();
            }
        }
Example #2
0
        internal void Home(CookiecutterSessionStartInfo ssi = null)
        {
            PageSequence.MoveCurrentToFirst();
            _updateCommandUI();

            InitializeAsync(false, ssi).DoNotWait();
        }
        internal void Home(CookiecutterSessionStartInfo ssi = null)
        {
            PageSequence.MoveCurrentToFirst();
            _updateCommandUI();

            InitializeAsync(false, ssi).HandleAllExceptions(_provider, GetType()).DoNotWait();
        }
Example #4
0
 internal void NewSession(CookiecutterSessionStartInfo ssi)
 {
     if (_cookiecutterPage != null)
     {
         _cookiecutterPage.NewSession(ssi);
     }
     else
     {
         // This method may be called immediately after showing the tool
         // window for the first time, which triggers a delayed initialization
         // of the cookiecutter page on idle, causing the page to be temporarily null.
         // Store the desired session start info so that when the page is initialized,
         // it uses it. Doing it in one step in init ensures only
         // one automatic search is triggered.
         _pendingNewSessionStartInfo = ssi;
     }
 }
Example #5
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 ssi = _pendingNewSessionStartInfo;

            _pendingNewSessionStartInfo = null;

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

            ((Frame)Content).Content = _cookiecutterPage;
        }
Example #6
0
 internal void NewSession(CookiecutterSessionStartInfo ssi)
 {
     Home(ssi);
 }
Example #7
0
        internal void NewCookiecutterSession(CookiecutterSessionStartInfo ssi = null)
        {
            var pane = ShowWindowPane(typeof(CookiecutterToolWindow), true) as CookiecutterToolWindow;

            pane.NewSession(ssi);
        }
Example #8
0
        internal async Task NewCookiecutterSessionAsync(CookiecutterSessionStartInfo ssi = null)
        {
            var pane = await ShowWindowPaneAsync <CookiecutterToolWindow>(true);

            pane.NewSession(ssi);
        }