private void SetProjectConfigInfo() { var configInfo = ProjectConfigInfoService.ReadProjectConfiguration(); if (string.IsNullOrEmpty(configInfo.ProjectType) || string.IsNullOrEmpty(configInfo.Framework) || string.IsNullOrEmpty(configInfo.Platform)) { var vm = new ProjectConfigurationViewModel(); ProjectConfigurationDialog projectConfig = new ProjectConfigurationDialog(vm); projectConfig.Owner = WizardShell.Current; projectConfig.ShowDialog(); if (vm.Result == DialogResult.Accept) { configInfo.ProjectType = vm.SelectedProjectType.Name; configInfo.Framework = vm.SelectedFramework.Name; configInfo.Platform = vm.SelectedPlatform; ProjectMetadataService.SaveProjectMetadata(configInfo, GenContext.ToolBox.Shell.GetActiveProjectPath()); ConfigFramework = configInfo.Framework; ConfigProjectType = configInfo.ProjectType; ConfigPlatform = configInfo.Platform; } else { Navigation.Cancel(); } } else { ConfigFramework = configInfo.Framework; ConfigProjectType = configInfo.ProjectType; ConfigPlatform = configInfo.Platform; } }
protected void AssertCorrectProjectConfigInfo(string expectedProjectType, string expectedFramework, string expectedPlatform) { var info = ProjectConfigInfoService.ReadProjectConfiguration(); Assert.Equal(expectedProjectType, info.ProjectType); Assert.Equal(expectedFramework, info.Framework); Assert.Equal(expectedPlatform, info.Platform); }
protected void AssertCorrectProjectConfigInfo(string expectedProjectType, string expectedFramework, string expectedPlatform) { var projectConfigInfoService = new ProjectConfigInfoService(GenContext.ToolBox.Shell); var info = projectConfigInfoService.ReadProjectConfiguration(); Assert.Equal(expectedProjectType, info.ProjectType); Assert.Equal(expectedFramework, info.Framework); Assert.Equal(expectedPlatform, info.Platform); }
private UserSelectionContext GetProjectConfigInfo(string language) { var projectConfigInfoService = new ProjectConfigInfoService(GenContext.ToolBox.Shell); var configInfo = projectConfigInfoService.ReadProjectConfiguration(); if (string.IsNullOrEmpty(configInfo.ProjectType) || string.IsNullOrEmpty(configInfo.Framework) || string.IsNullOrEmpty(configInfo.Platform)) { var vm = new ProjectConfigurationViewModel(language); var projectConfig = new ProjectConfigurationDialog(vm); GenContext.ToolBox.Shell.ShowModal(projectConfig); if (vm.Result == DialogResult.Accept) { configInfo.ProjectType = vm.SelectedProjectType.Name; configInfo.Framework = vm.SelectedFramework.Name; configInfo.Platform = vm.SelectedPlatform; if (configInfo.Platform == Platforms.WinUI) { configInfo.AppModel = vm.SelectedAppModel; } ProjectMetadataService.SaveProjectMetadata(configInfo, GenContext.ToolBox.Shell.GetActiveProjectPath()); var userSeletion = new UserSelectionContext(language, configInfo.Platform) { ProjectType = configInfo.ProjectType, FrontEndFramework = configInfo.Framework, }; if (!string.IsNullOrEmpty(configInfo.AppModel)) { userSeletion.AddAppModel(configInfo.AppModel); } return(userSeletion); } return(null); } else { var userSeletion = new UserSelectionContext(language, configInfo.Platform) { ProjectType = configInfo.ProjectType, FrontEndFramework = configInfo.Framework, }; if (!string.IsNullOrEmpty(configInfo.AppModel)) { userSeletion.AddAppModel(configInfo.AppModel); } return(userSeletion); } }
protected void AssertCorrectProjectConfigInfo(UserSelectionContext context) { var projectConfigInfoService = new ProjectConfigInfoService(GenContext.ToolBox.Shell); var info = projectConfigInfoService.ReadProjectConfiguration(); Assert.Equal(context.ProjectType, info.ProjectType); Assert.Equal(context.FrontEndFramework, info.Framework); Assert.Equal(context.Platform, info.Platform); if (!string.IsNullOrEmpty(context.GetAppModel())) { Assert.Equal(context.GetAppModel(), info.AppModel); } }
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); }
public bool Visible(TemplateType templateType) { ThreadHelper.ThrowIfNotOnUIThread(); if (!_shell.Project.GetActiveProjectIsWts()) { return(false); } var projectConfigInfoService = new ProjectConfigInfoService(_shell); var configInfo = projectConfigInfoService.ReadProjectConfiguration(); // Do not allow right click on WinUI Blank project type if (configInfo?.Platform == Platforms.WinUI && configInfo?.ProjectType == BlankProjectType) { return(false); } var rightClickOptions = _availableOptions.FirstOrDefault(o => o.Platform == configInfo?.Platform && o.Language == projectConfigInfoService.GetProgrammingLanguage() && o.AppModel == configInfo?.AppModel); return(rightClickOptions != null && rightClickOptions.TemplateTypes.Contains(templateType)); }