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; } }
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); } }
public static (string ProjectType, string Framework, string Platform) ReadProjectConfiguration() { var projectMetadata = ProjectMetadataService.GetProjectMetadata(); if (!string.IsNullOrEmpty(projectMetadata.ProjectType) && !string.IsNullOrEmpty(projectMetadata.Framework) && !string.IsNullOrEmpty(projectMetadata.Platform)) { return(projectMetadata.ProjectType, projectMetadata.Framework, projectMetadata.Platform); } var inferredConfig = InferProjectConfiguration(projectMetadata.ProjectType, projectMetadata.Framework, projectMetadata.Platform); if (!string.IsNullOrEmpty(inferredConfig.ProjectType) && !string.IsNullOrEmpty(inferredConfig.Framework) && !string.IsNullOrEmpty(inferredConfig.Platform)) { ProjectMetadataService.SaveProjectMetadata(inferredConfig.ProjectType, inferredConfig.Framework, inferredConfig.Platform); } return(inferredConfig); }
public static ProjectMetadata ReadProjectConfiguration() { var projectMetadata = ProjectMetadataService.GetProjectMetadata(); if (IsValid(projectMetadata)) { return(projectMetadata); } var inferredConfig = InferProjectConfiguration(projectMetadata); if (IsValid(inferredConfig)) { ProjectMetadataService.SaveProjectMetadata(inferredConfig); } return(inferredConfig); }
public bool Visible(TemplateType templateType) { ThreadHelper.ThrowIfNotOnUIThread(); if (!_shell.GetActiveProjectIsWts()) { return(false); } var projectPlatform = ProjectMetadataService.GetProjectMetadata(_shell.GetActiveProjectPath()).Platform; if (availableOptions.ContainsKey(projectPlatform) && availableOptions[projectPlatform].Contains(templateType)) { return(true); } else { return(false); } }
public ValidationResult Validate() { var result = new ValidationResult(); var projectType = ProjectMetadataService.GetProjectMetadata(GenContext.ToolBox.Shell.GetActiveProjectPath()).ProjectType; if (projectType == "SplitView" && HasOldNavigationView()) { var message = new ValidationMessage { Message = Resources.StringRes.ValidatorHasOldNavigationViewMessage, Url = string.Format(Resources.StringRes.ValidatorHasOldNavigationViewLink, Core.Configuration.Current.GitHubDocsUrl), HyperLinkMessage = Resources.StringRes.ValidatorHasOldNavigationViewLinkMessage, }; result.IsValid = false; result.ErrorMessages.Add(message); } return(result); }
public ValidationResult Validate() { var result = new ValidationResult(); var framework = ProjectMetadataService.GetProjectMetadata(GenContext.ToolBox.Shell.GetActiveProjectPath()).Framework; if (framework == "MVVMLight" && HasLocatorAsApplicationResource()) { var message = new ValidationMessage { Message = Resources.StringRes.ValidatorHasOldMvvmLightLocatorMessage, Url = string.Format(Resources.StringRes.ValidatorHasOldMvvmLightLocatorLink, Core.Configuration.Current.GitHubDocsUrl), HyperLinkMessage = Resources.StringRes.ValidatorHasOldMvvmLightLocatorLinkMessage, }; result.IsValid = false; result.ErrorMessages.Add(message); } return(result); }
public ValidationResult Validate() { var result = new ValidationResult(); var projectType = ProjectMetadataService.GetProjectMetadata().ProjectType; if (projectType == "SplitView" && HasHamburgerMenu()) { var message = new ValidationMessage { Message = Resources.StringRes.ValidatorHasHamburgerMenuMessage, Url = string.Format(Resources.StringRes.ValidatorHasHamburgerMenuLink, Core.Configuration.Current.GitHubDocsUrl), HyperLinkMessage = Resources.StringRes.ValidatorHasHamburgerMenuLinkMessage, }; result.IsValid = false; result.ErrorMessages.Add(message); } return(result); }
private bool EnsureGenContextInitialized() { var projectLanguage = _shell.GetActiveProjectLanguage(); var projectPlatform = ProjectMetadataService.GetProjectMetadata(_shell.GetActiveProjectPath()).Platform; if (!string.IsNullOrEmpty(projectLanguage)) { if (GenContext.CurrentLanguage != projectLanguage || GenContext.CurrentPlatform != projectPlatform) { #if DEBUG GenContext.Bootstrap(new LocalTemplatesSource(string.Empty), _shell, projectPlatform, projectLanguage); #else var mstxFilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "InstalledTemplates"); GenContext.Bootstrap(new RemoteTemplatesSource(projectPlatform, projectLanguage, mstxFilePath, new DigitalSignatureService()), _shell, projectPlatform, projectLanguage); #endif } return(true); } return(false); }