public NoOpService()
            {
                this.noOpRegistration = new GlobalOperationRegistration(this, "NoOp");

                // here to shut up never used warnings.
                var started = Started;
                var stopped = Stopped;
            }
            public NoOpService()
            {
                this.noOpRegistration = new GlobalOperationRegistration(this, "NoOp");

                // here to shut up never used warnings.
                var started = Started;
                var stopped = Stopped;
            }
Ejemplo n.º 3
0
        public void Dispose()
        {
            if (_operation != null)
            {
                _operation.Dispose();
                _operation = null;
            }

            if (_notificationService != null)
            {
                _notificationService = null;
                KnownUIContexts.SolutionBuildingContext.UIContextChanged -= SolutionBuildingContextChanged;
            }
        }
        public VisualStudioWaitContext(
            IGlobalOperationNotificationService notificationService,
            IVsThreadedWaitDialogFactory dialogFactory,
            string title,
            string message,
            bool allowCancel)
        {
            _title = title;
            _message = message;
            _allowCancel = allowCancel;
            _cancellationTokenSource = new CancellationTokenSource();

            _dialog = CreateDialog(dialogFactory);
            _registration = notificationService.Start(title);
        }
        public override void Done(GlobalOperationRegistration registration)
        {
            lock (_gate)
            {
                var result = _registrations.Remove(registration);
                Contract.ThrowIfFalse(result);

                if (_registrations.Count == 0)
                {
                    var operations = _operations.AsImmutable();
                    _operations.Clear();

                    RaiseGlobalOperationStoppedAsync(operations, cancelled: false);
                }
            }
        }
        public override void Cancel(GlobalOperationRegistration registration)
        {
            lock (_gate)
            {
                var result = _registrations.Remove(registration);
                Contract.ThrowIfFalse(result);

                if (_registrations.Count == 0)
                {
                    var operations = _operations.AsImmutable();
                    _operations.Clear();

                    // We don't care if an individual operation has canceled.
                    // We only care whether whole thing has cancelled or not.
                    RaiseGlobalOperationStoppedAsync(operations, cancelled: true);
                }
            }
        }
        public override void Cancel(GlobalOperationRegistration registration)
        {
            lock (gate)
            {
                var result = this.registrations.Remove(registration);
                Contract.ThrowIfFalse(result);

                if (this.registrations.Count == 0)
                {
                    var operations = this.operations.AsImmutable();
                    this.operations.Clear();

                    // it doesnt care whether indivisual operation has canceled or not.
                    // it only care whether whole thing has cancelled or not.
                    RaiseGlobalOperationStopped(operations, cancelled: true);
                }
            }
        }
Ejemplo n.º 8
0
        public VisualStudioWaitContext(
            IGlobalOperationNotificationService notificationService,
            IVsThreadedWaitDialogFactory dialogFactory,
            string title,
            string message,
            bool allowCancel, 
            bool showProgress)
        {
            _title = title;
            _message = message;
            _allowCancel = allowCancel;
            _cancellationTokenSource = new CancellationTokenSource();

            this.ProgressTracker = showProgress
                ? new ProgressTracker((_1, _2) => UpdateDialog())
                : new ProgressTracker();

            _dialog = CreateDialog(dialogFactory, showProgress);
            _registration = notificationService.Start(title);
        }
Ejemplo n.º 9
0
        private void SolutionBuildingContextChanged(object sender, UIContextChangedEventArgs e)
        {
            if (_notificationService != null)
            {
                if (e.Activated)
                {
                    if (_operation != null)
                    {
                        _operation.Dispose();
                    }

                    _operation = _notificationService.Start("Solution Building");
                }
                else if (_operation != null)
                {
                    _operation.Done();
                    _operation.Dispose();
                    _operation = null;
                }
            }
        }
        public override GlobalOperationRegistration Start(string operation)
        {
            lock (_gate)
            {
                // create new registration
                var registration = new GlobalOperationRegistration(this, operation);

                // states
                _registrations.Add(registration);
                _operations.Add(operation);

                // the very first one
                if (_registrations.Count == 1)
                {
                    Contract.ThrowIfFalse(_operations.Count == 1);
                    RaiseGlobalOperationStartedAsync();
                }

                return(registration);
            }
        }
        public override GlobalOperationRegistration Start(string operation)
        {
            lock (_gate)
            {
                // create new registration
                var registration = new GlobalOperationRegistration(this, operation);

                // states
                _registrations.Add(registration);
                _operations.Add(operation);

                // the very first one
                if (_registrations.Count == 1)
                {
                    Contract.ThrowIfFalse(_operations.Count == 1);
                    RaiseGlobalOperationStarted();
                }

                return registration;
            }
        }
        public override void Cancel(GlobalOperationRegistration registration)
        {
            lock (_gate)
            {
                var result = _registrations.Remove(registration);
                Contract.ThrowIfFalse(result);

                if (_registrations.Count == 0)
                {
                    var operations = _operations.AsImmutable();
                    _operations.Clear();

                    // We don't care if an individual operation has canceled.
                    // We only care whether whole thing has cancelled or not.
                    RaiseGlobalOperationStopped(operations, cancelled: true);
                }
            }
        }
 public abstract void Done(GlobalOperationRegistration registration);
 public override void Cancel(GlobalOperationRegistration registration)
 {
     // do nothing
 }
 public override void Done(GlobalOperationRegistration registration)
 {
     // do nothing
 }
 public override void Done(GlobalOperationRegistration registration)
 {
     // do nothing
 }
 public override void Cancel(GlobalOperationRegistration registration)
 {
     // do nothing
 }
 public abstract void Cancel(GlobalOperationRegistration registration);
 public abstract void Cancel(GlobalOperationRegistration registration);
 public abstract void Done(GlobalOperationRegistration registration);
        public override void Done(GlobalOperationRegistration registration)
        {
            lock (_gate)
            {
                var result = _registrations.Remove(registration);
                Contract.ThrowIfFalse(result);

                if (_registrations.Count == 0)
                {
                    var operations = _operations.AsImmutable();
                    _operations.Clear();

                    RaiseGlobalOperationStopped(operations, cancelled: false);
                }
            }
        }