public void ProcessComplete(ProcessResults processReults)
        {
            processReults.ThrowIfNull(nameof(processReults));

            ClearConsoleLine(0);

            lock (CLIConsts.ConsolWriteSync)
            {
                if (processReults.Trace.HasError)
                {
                    if (processReults.Trace.NotificationErrorType == NotificationErrorType.Attention)
                    {
                        SetErrorInstruction(processReults.Trace.InstructionsMessage, processReults.Trace.NotificationErrorType);
                    }
                    else
                    {
                        SetErrorInstruction(CLITextResources.ProcessCompleteWithErrors, NotificationErrorType.Error);
                        SetErrorInstruction("--------------------------------", NotificationErrorType.Error);
                        SetErrorMessage(processReults.Trace.GetOnlyErrorsStatesLogAsString());
                        SetErrorInstruction(processReults.Trace.InstructionsMessage, processReults.Trace.NotificationErrorType);
                    }
                }
                else
                {
                    _console.ForegroundColor = ConsoleColor.Green;
                    _console.Out.WriteLine(CLITextResources.ProcessCompleteSuccessfully);
                    _console.ForegroundColor = ConsoleColor.White;
                }

                _console.ForegroundColor = ConsoleColor.White;
            }
        }
示例#2
0
        public void AfterComplete(ProcessResults processResults)
        {
            processResults.ThrowIfNull(nameof(processResults));

            _processTrace = processResults.Trace;

            System.Threading.Thread.Sleep(500);


            if (_processTrace.HasError)
            {
                NotificationsViewModelData.ProcessStatusMessage = _processTrace.InstructionsMessage;
                //$"{_processTrace.InstructionsMessage} -> {_processTrace.ErrorMessage}";

                NotificationsViewModelData.NotificationStatus = _processTrace.NotificationErrorType
                                                                switch
                {
                    NotificationErrorType.Error => NotificationStatus.Error,
                    NotificationErrorType.Attention => NotificationStatus.Attention,
                    _ => throw new Exception($"Invalid NotificationErrorType '{_processTrace.NotificationErrorType}'"),
                };
            }
            else
            {
                NotificationsViewModelData.NotificationStatus   = NotificationStatus.CompleteSuccessfully;
                NotificationsViewModelData.ProcessStatusMessage = UITextResources.CompleteSuccessfullyMessage;
            }
        }
        public void HandleProcessErrors(bool isNewProjectConfig, ProcessResults processResults)
        {
            processResults.ThrowIfNull(nameof(processResults));

            _notificationsViewModel.AfterComplete(processResults);

            SetErrorsToUiElements(processResults.Trace);

            _editProjectControls.ImgErrorVisible        = processResults.Trace.HasError;
            _editProjectControls.ImgValidVisible        = !processResults.Trace.HasError;
            _editProjectControls.BtnNavToProcessVisible = !processResults.Trace.HasError;

            if (isNewProjectConfig)
            {
                ChangeViewState(EditProjectViewStateType.New);
            }
            else
            {
                ChangeViewState(EditProjectViewStateType.Update);
            }
        }