コード例 #1
0
        public async void OpenProject(string path)
        {
            _loadingDisplayer.ShowLoading($"Opening project at {Path.GetFileName(path)}");
            UnimaConfig config = null;

            try
            {
                config = await Task.Run(() => _mediator.Send(new OpenProjectCommand(path, true)));

                _mutationModuleTabOpener.OpenOverviewTab(config);
            }
            catch (ValidationException ex)
            {
                ErrorDialogDisplayer.ShowErrorDialog("Unexpected error", "Failed to open project.", ex.Message);
                return;
            }
            catch (OpenProjectException ex)
            {
                ErrorDialogDisplayer.ShowErrorDialog("Unexpected error", "Failed to open project.", ex.InnerException?.ToString());
                return;
            }
            finally
            {
                _loadingDisplayer.HideLoading();
            }
        }
コード例 #2
0
ファイル: NewProjectViewModel.cs プロジェクト: mrksbrg/Unima
        private async void CreateProject()
        {
            var projectPath = Path.Combine(ProjectPath, $"{ProjectName}.json");

            var config = new UnimaFileConfig
            {
                IgnoredProjects = SelectedProjectsInSolution.Where(s => !s.IsSelected).Select(s => s.ProjectInfo.Name).ToList(),
                SolutionPath    = SolutionPath,
                TestProjects    = SelectedTestProjectInSolution.Where(s => s.IsSelected).Select(s => s.ProjectInfo.Name).ToList(),
                TestRunner      = TestRunnerTypes[SelectedTestRunnerIndex]
            };

            await _mediator.Send(new CreateProjectCommand(projectPath, config));

            await _mediator.Send(new AddProjectHistoryCommand(projectPath));

            _mutationModuleTabOpener.OpenOverviewTab(await _mediator.Send(new OpenProjectCommand(projectPath, true)));
        }