public void AddNewPage()
        {
            if (_shell.GetActiveProjectIsWts())
            {
                SetContext();

                try
                {
                    var userSelection = NewItemGenController.Instance.GetUserSelectionNewPage(_shell.GetActiveProjectLanguage(), new VSStyleValuesProvider());

                    if (userSelection != null)
                    {
                        SafeThreading.JoinableTaskFactory.Run(
                            async() =>
                        {
                            await SafeThreading.JoinableTaskFactory.SwitchToMainThreadAsync();
                            NewItemGenController.Instance.FinishGeneration(userSelection);
                        },
                            JoinableTaskCreationOptions.LongRunning);

                        _shell.ShowStatusBarMessage(string.Format(StringRes.StatusBarNewItemAddPageSuccess, userSelection.Pages[0].name));
                    }
                }
                catch (WizardBackoutException)
                {
                    _shell.ShowStatusBarMessage(StringRes.StatusBarNewItemAddPageCancelled);
                }
            }
        }
        public bool Visible(TemplateType templateType)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (!_shell.GetActiveProjectIsWts())
            {
                return(false);
            }

            var projectConfigInfoService = new ProjectConfigInfoService(_shell);
            var configInfo = projectConfigInfoService.ReadProjectConfiguration();

            var rightClickOptions = _availableOptions.FirstOrDefault(o =>
                                                                     o.Platform == configInfo.Platform &&
                                                                     o.Language == projectConfigInfoService.GetProgrammingLanguage() &&
                                                                     o.AppModel == configInfo.AppModel);

            return(rightClickOptions != null?rightClickOptions.TemplateTypes.Contains(templateType) : false);
        }
Exemple #3
0
        public void AddNewPage()
        {
            if (!_shell.GetActiveProjectIsWts())
            {
                return;
            }

            try
            {
                SetContext();
                var userSelection    = WizardLauncher.Instance.StartAddPage(_shell.GetActiveProjectLanguage(), new VSStyleValuesProvider());
                var statusBarMessage = string.Format(StringRes.StatusBarNewItemAddPageSuccess, userSelection.Pages[0].name);
                FinishGeneration(userSelection, statusBarMessage);
            }
            catch (WizardBackoutException)
            {
                _shell.ShowStatusBarMessage(StringRes.StatusBarNewItemAddPageCancelled);
            }
        }
Exemple #4
0
        public void AddNewPage()
        {
            if (_shell.GetActiveProjectIsWts())
            {
                SetContext();

                try
                {
                    var userSelection = NewItemGenController.Instance.GetUserSelectionNewPage();

                    if (userSelection != null)
                    {
                        NewItemGenController.Instance.FinishGeneration(userSelection);
                        _shell.ShowStatusBarMessage(string.Format(StringRes.NewItemAddPageSuccessStatusMsg, userSelection.Pages[0].name));
                    }
                }
                catch (WizardBackoutException)
                {
                    _shell.ShowStatusBarMessage(StringRes.NewItemAddPageCancelled);
                }
            }
        }