Пример #1
0
 public WelcomeViewModel(
     IStartModuleTabOpener startModuleTabOpener,
     IMediator mediator,
     MutationReportOpener mutationReportOpener,
     UnimaProjectOpener projectOpener,
     FilePicker filePickerService)
 {
     _startModuleTabOpener     = startModuleTabOpener;
     _mediator                 = mediator;
     _mutationReportOpener     = mutationReportOpener;
     _projectOpener            = projectOpener;
     _filePickerService        = filePickerService;
     CreateNewProjectCommand   = new DelegateCommand(() => _startModuleTabOpener.OpenNewProjectTab());
     OpenProjectCommand        = new DelegateCommand(OpenProject);
     OpenReportCommand         = new DelegateCommand(OpenReport);
     OpenHistoryProjectCommand = new DelegateCommand <string>(OpenProject);
     ProjectHistory            = _mediator.Send(new GetProjectHistoryCommand()).Result;
 }
        private async Task GoNext()
        {
            var result = CommonDialogDisplayer.ShowInfoDialog("We will now clone and build the project. Are you sure? ");

            if (!result)
            {
                return;
            }

            try
            {
                _loadingDisplayer.ShowLoading("Cloning project and building project..");
                await _gitCloner.CloneSolutionAsync(RepositoryUrl, BranchName, Username, Password, LocalPath);

                _loadingDisplayer.ShowLoading("Looking for solution..");
                var solutionPath = _solutionFinder.FindSolution(LocalPath);

                if (solutionPath == null)
                {
                    throw new Exception($"Could not find any solution file in the {LocalPath} directory or subdirectories.");
                }

                var gitInfo = new GitInfo
                {
                    RepositoryUrl = RepositoryUrl,
                    Branch        = BranchName,
                    LocalPath     = LocalPath,
                    Username      = Username,
                    Password      = Password
                };

                _loadingDisplayer.HideLoading();

                _startModuleTabOpener.OpenNewProjectTab(gitInfo, solutionPath);
            }
            catch (Exception ex)
            {
                _loadingDisplayer.HideLoading();
                CommonDialogDisplayer.ShowErrorDialog("Error when cloning project", ex.Message, ex.ToString());
            }
        }