コード例 #1
0
        /// <summary>
        /// Called when the NodeModel's CachedValue property is updated
        /// </summary>
        private void CachedValueChanged()
        {
            Dispatcher.BeginInvoke(new Action(delegate
            {
                // There is no preview control or the preview control is
                // currently in transition state (it can come back to handle
                // the new data later on when it is ready).
                if ((previewControl == null))
                {
                    return;
                }

                // Enqueue an update of the preview control once it has completed its
                // transition
                if (previewControl.IsInTransition)
                {
                    previewControl.EnqueueBindToDataSource(ViewModel.NodeModel.CachedValue);
                    return;
                }

                if (previewControl.IsHidden) // The preview control is hidden.
                {
                    // Invalidate the previously bound data, if any.
                    if (previewControl.IsDataBound)
                    {
                        previewControl.BindToDataSource(null);
                    }
                    return;
                }

                previewControl.BindToDataSource(ViewModel.NodeModel.CachedValue);
            }));
        }
コード例 #2
0
        /// <summary>
        /// Whenever property "NodeModel.IsUpdated" is set to true, this method
        /// is invoked. It will result in preview control updated, if the control
        /// is currently visible. Otherwise this call will be ignored.
        /// </summary>
        ///
        private void HandleCacheValueUpdated()
        {
            Dispatcher.BeginInvoke(new Action(delegate
            {
                // There is no preview control or the preview control is
                // currently in transition state (it can come back to handle
                // the new data later on when it is ready).
                if ((previewControl == null) || previewControl.IsInTransition)
                {
                    return;
                }

                if (previewControl.IsHidden) // The preview control is hidden.
                {
                    // Invalidate the previously bound data, if any.
                    if (previewControl.IsDataBound)
                    {
                        previewControl.BindToDataSource(null);
                    }
                    return;
                }

                previewControl.BindToDataSource(
                    ViewModel.NodeLogic.GetCachedValueFromEngine(
                        ViewModel.DynamoViewModel.EngineController));
            }));
        }
コード例 #3
0
        private void TryShowPreviewBubbles()
        {
            nodeWasClicked = false;

            // Always set old ZIndex to the last value, even if mouse is not over the node.
            oldZIndex = NodeViewModel.StaticZIndex;

            // There is no need run further.
            if (IsPreviewDisabled())
            {
                return;
            }

            if (PreviewControl.IsInTransition) // In transition state, come back later.
            {
                return;
            }

            if (PreviewControl.IsHidden)
            {
                if (!previewControl.IsDataBound)
                {
                    PreviewControl.BindToDataSource();
                }

                PreviewControl.TransitionToState(PreviewControl.State.Condensed);
            }

            Dispatcher.DelayInvoke(previewDelay, BringToFront);
        }
コード例 #4
0
        /// <summary>
        /// Called when the NodeModel's CachedValue property is updated
        /// </summary>
        private void CachedValueChanged()
        {
            Dispatcher.BeginInvoke(new Action(delegate
            {
                // There is no preview control or the preview control is
                // currently in transition state (it can come back to handle
                // the new data later on when it is ready).
                // If node is frozen, we shouldn't update cached value.
                // We keep value, that was before freezing.
                if ((previewControl == null) || ViewModel.IsFrozen)
                {
                    return;
                }

                // Enqueue an update of the preview control once it has completed its
                // transition
                if (previewControl.IsInTransition)
                {
                    previewControl.RequestForRefresh();
                    return;
                }

                if (previewControl.IsHidden) // The preview control is hidden.
                {
                    previewControl.IsDataBound = false;
                    return;
                }

                previewControl.BindToDataSource();
            }));
        }