Esempio n. 1
0
        private void ExecuteUpdate(BoundSonarQubeProject binding)
        {
            Debug.Assert(binding != null);

            EventDrivenBindingUpdate binder = new EventDrivenBindingUpdate(this.host, binding);

            EventHandler <BindingRequestResult> onFinished = null;

            onFinished = (o, result) =>
            {
                // Resume click handling (if applicable)
                this.currentErrorWindowInfoBarHandlingClick = false;

                binder.Finished -= onFinished;
                switch (result)
                {
                case BindingRequestResult.CommandIsBusy:
                    // Might be building/debugging/etc...
                    // Need to click 'Update' again to retry.
                    this.OutputMessage(Strings.SonarLintInfoBarUpdateCommandIsBusyRetry);
                    break;

                case BindingRequestResult.NoActiveSection:
                    // We drive the process via the active section, we can proceed without it.
                    // Need to click 'Update' again.
                    // This is case is fairly unlikely, so just writing to the output window will be enough
                    this.OutputMessage(Strings.SonarLintInfoBarUpdateCommandRetryNoActiveSection);
                    break;

                case BindingRequestResult.StartedUpdating:
                case BindingRequestResult.RequestIsIrrelevant:
                    this.ClearCurrentInfoBar();
                    break;

                default:
                    Debug.Fail($"Unexpected result: {result}");
                    break;
                }
            };

            binder.Finished += onFinished;
            binder.ConnectAndBind();
        }
        private void ExecuteUpdate(BoundSonarQubeProject binding)
        {
            Debug.Assert(binding != null);

            EventDrivenBindingUpdate binder = new EventDrivenBindingUpdate(this.host, binding);

            EventHandler<BindingRequestResult> onFinished = null;
            onFinished = (o, result) =>
            {
                // Resume click handling (if applicable)
                this.currentErrorWindowInfoBarHandlingClick = false;

                binder.Finished -= onFinished;
                switch (result)
                {
                    case BindingRequestResult.CommandIsBusy:
                        // Might be building/debugging/etc...
                        // Need to click 'Update' again to retry.
                        this.OutputMessage(Strings.SonarLintInfoBarUpdateCommandIsBusyRetry);
                        break;
                    case BindingRequestResult.NoActiveSection:
                        // We drive the process via the active section, we can proceed without it.
                        // Need to click 'Update' again.
                        // This is case is fairly unlikely, so just writing to the output window will be enough
                        this.OutputMessage(Strings.SonarLintInfoBarUpdateCommandRetryNoActiveSection);
                        break;
                    case BindingRequestResult.StartedUpdating:
                    case BindingRequestResult.RequestIsIrrelevant:
                        this.ClearCurrentInfoBar();
                        break;
                    default:
                        Debug.Fail($"Unexpected result: {result}");
                        break;
                }
            };

            binder.Finished += onFinished;
            binder.ConnectAndBind();
        }