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); }