Ejemplo n.º 1
0
 public ProjectConfigurationDialog(ProjectConfigurationViewModel vm)
 {
     DataContext    = vm;
     vm.CloseAction = () => Close();
     vm.Initialize();
     InitializeComponent();
 }
Ejemplo n.º 2
0
        public ProjectConfigurationWindow(Window mainWindow)
        {
            ViewModel   = new ProjectConfigurationViewModel(this);
            DataContext = ViewModel;
            Owner       = mainWindow;
            Loaded     += ProjectConfigurationWindow_Loaded;

            InitializeComponent();
        }
Ejemplo n.º 3
0
        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);
            }
        }