Beispiel #1
0
        public VariableSubscription Subscribe(
            int frameIndex,
            string variableExpression,
            Action <DebugEvaluationResult> executeAction)
        {
            var token = new VariableSubscriptionToken(frameIndex, variableExpression);

            var subscription = new VariableSubscription(
                token,
                executeAction,
                Unsubscribe);

            lock (_subscribers) {
                List <VariableSubscription> subscriptions;
                if (_subscribers.TryGetValue(subscription.Token, out subscriptions))
                {
                    subscriptions.Add(subscription);
                }
                else
                {
                    _subscribers.Add(
                        token,
                        new List <VariableSubscription>()
                    {
                        subscription
                    });
                }
            }

            return(subscription);
        }
        public void Dispose() {
            if (_globalEnvSubscription != null) {
                _globalEnvSubscription.Dispose();
                _globalEnvSubscription = null;
            }

            RootTreeGrid.Sorting -= RootTreeGrid_Sorting;
        }
Beispiel #3
0
        public void Dispose()
        {
            if (_globalEnvSubscription != null)
            {
                _globalEnvSubscription.Dispose();
                _globalEnvSubscription = null;
            }

            RootTreeGrid.Sorting -= RootTreeGrid_Sorting;
        }
        public VariableView(IRToolsSettings settings) {
            _settings = settings;

            InitializeComponent();

            SortDirection = ListSortDirection.Ascending;

            var variableProvider = VsAppShell.Current.ExportProvider.GetExportedValue<IVariableDataProvider>();

            SetRootNode(EvaluationWrapper.Ellipsis);

            _globalEnvSubscription = variableProvider.Subscribe(0, VariableProvider.GlobalEnvironmentExpression, OnGlobalEnvironmentEvaluation);

            RootTreeGrid.Sorting += RootTreeGrid_Sorting;
        }
Beispiel #5
0
        public VariableView(IRToolsSettings settings)
        {
            _settings = settings;

            InitializeComponent();

            SortDirection = ListSortDirection.Ascending;

            var variableProvider = VsAppShell.Current.ExportProvider.GetExportedValue <IVariableDataProvider>();

            SetRootNode(EvaluationWrapper.Ellipsis);

            _globalEnvSubscription = variableProvider.Subscribe(0, VariableProvider.GlobalEnvironmentExpression, OnGlobalEnvironmentEvaluation);

            RootTreeGrid.Sorting += RootTreeGrid_Sorting;
        }
Beispiel #6
0
 public void Unsubscribe(VariableSubscription subscription)
 {
     lock (_subscribers) {
         List <VariableSubscription> subscriptions;
         if (_subscribers.TryGetValue(subscription.Token, out subscriptions))
         {
             if (!subscriptions.Remove(subscription))
             {
                 Debug.Fail("Subscription is not found");
             }
             if (subscriptions.Count == 0)
             {
                 _subscribers.Remove(subscription.Token);
             }
         }
     }
 }
        internal void SetEvaluation(EvaluationWrapper evaluation) {
            ClearError();

            VariableGrid.Initialize(new GridDataProvider(evaluation));

            _evaluation = evaluation;

            if (_subscription != null) {
                _variableProvider.Unsubscribe(_subscription);
                _subscription = null;
            }

            _subscription = _variableProvider.Subscribe(
                evaluation.FrameIndex,
                evaluation.Expression,
                SubscribeAction);
        }
Beispiel #8
0
        internal void SetEvaluation(EvaluationWrapper evaluation)
        {
            ClearError();

            VariableGrid.Initialize(new GridDataProvider(evaluation));

            _evaluation = evaluation;

            if (_subscription != null)
            {
                _variableProvider.Unsubscribe(_subscription);
                _subscription = null;
            }

            _subscription = _variableProvider.Subscribe(
                evaluation.FrameIndex,
                evaluation.Expression,
                SubscribeAction);
        }
        public VariableSubscription Subscribe(
            int frameIndex,
            string variableExpression,
            Action<DebugEvaluationResult> executeAction) {

            var token = new VariableSubscriptionToken(frameIndex, variableExpression);

            var subscription = new VariableSubscription(
                token,
                executeAction,
                Unsubscribe);

            lock (_subscribers) {
                List<VariableSubscription> subscriptions;
                if (_subscribers.TryGetValue(subscription.Token, out subscriptions)) {
                    subscriptions.Add(subscription);
                } else {
                    _subscribers.Add(
                        token,
                        new List<VariableSubscription>() { subscription });
                }
            }

            return subscription;
        }
 public void Unsubscribe(VariableSubscription subscription) {
     lock (_subscribers) {
         List<VariableSubscription> subscriptions;
         if (_subscribers.TryGetValue(subscription.Token, out subscriptions)) {
             if (!subscriptions.Remove(subscription)) {
                 Debug.Fail("Subscription is not found");
             }
             if (subscriptions.Count == 0) {
                 _subscribers.Remove(subscription.Token);
             }
         }
     }
 }