예제 #1
0
        private void UpdateBubbleContent()
        {
            if (ErrorBubble == null || DynamoViewModel == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(NodeModel.ToolTipText))
            {
                if (NodeModel.State != ElementState.Error && NodeModel.State != ElementState.Warning)
                {
                    ErrorBubble.ChangeInfoBubbleStateCommand.Execute(InfoBubbleViewModel.State.Minimized);
                }
            }
            else
            {
                if (!DynamoViewModel.CurrentSpaceViewModel.Errors.Contains(ErrorBubble))
                {
                    return;
                }

                var topLeft  = new Point(NodeModel.X, NodeModel.Y);
                var botRight = new Point(NodeModel.X + NodeModel.Width, NodeModel.Y + NodeModel.Height);
                InfoBubbleViewModel.Style style = NodeModel.State == ElementState.Error
                    ? InfoBubbleViewModel.Style.ErrorCondensed
                    : InfoBubbleViewModel.Style.WarningCondensed;
                // NOTE!: If tooltip is not cached here, it will be cleared once the dispatcher is invoked below
                string content = NodeModel.ToolTipText;
                const InfoBubbleViewModel.Direction connectingDirection = InfoBubbleViewModel.Direction.Bottom;
                var data = new InfoBubbleDataPacket(style, topLeft, botRight, content, connectingDirection);

                ErrorBubble.UpdateContentCommand.Execute(data);
                ErrorBubble.ChangeInfoBubbleStateCommand.Execute(InfoBubbleViewModel.State.Pinned);
            }
        }
예제 #2
0
        private void UpdatePreviewBubbleContent()
        {
            if (this.PreviewBubble == null || this.NodeModel is Watch)
            {
                return;
            }

            //create data packet to send to preview bubble
            InfoBubbleViewModel.Style style = InfoBubbleViewModel.Style.PreviewCondensed;
            Point  topLeft  = new Point(NodeModel.X, NodeModel.Y);
            Point  botRight = new Point(NodeModel.X + NodeModel.Width, NodeModel.Y + NodeModel.Height);
            string content  = this.OldValue;

            InfoBubbleViewModel.Direction connectingDirection = InfoBubbleViewModel.Direction.Top;
            InfoBubbleDataPacket          data = new InfoBubbleDataPacket(style, topLeft, botRight, content, connectingDirection);

            //update preview bubble
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Dispatcher.BeginInvoke((new Action(() =>
            {
                if (dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Previews.Contains(this.PreviewBubble))
                {
                    this.PreviewBubble.UpdateContentCommand.Execute(data);
                }
            })));
        }
예제 #3
0
 private void UpdateErrorBubbleContent()
 {
     if (this.ErrorBubble == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(NodeModel.ToolTipText))
     {
         if (ErrorBubble.Opacity != 0)
         {
             ErrorBubble.SetAlwaysVisibleCommand.Execute(false);
             ErrorBubble.InstantCollapseCommand.Execute(null);
         }
     }
     else
     {
         Point topLeft  = new Point(NodeModel.X, NodeModel.Y);
         Point botRight = new Point(NodeModel.X + NodeModel.Width, NodeModel.Y + NodeModel.Height);
         InfoBubbleViewModel.Style style = InfoBubbleViewModel.Style.Error;
         string content = NodeModel.ToolTipText;
         InfoBubbleViewModel.Direction connectingDirection = InfoBubbleViewModel.Direction.Bottom;
         InfoBubbleDataPacket          data = new InfoBubbleDataPacket(style, topLeft, botRight, content, connectingDirection);
         dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Dispatcher.BeginInvoke((new Action(() =>
         {
             if (!dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Errors.Contains(this.ErrorBubble))
             {
                 return;
             }
             this.ErrorBubble.UpdateContentCommand.Execute(data);
             this.ErrorBubble.SetAlwaysVisibleCommand.Execute(true);
             this.ErrorBubble.InstantAppearCommand.Execute(null);
         })));
     }
 }
예제 #4
0
        private void UpdateErrorBubbleContent()
        {
            if (this.ErrorBubble == null || dynSettings.Controller == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(NodeModel.ToolTipText))
            {
                if (NodeModel.State != ElementState.ERROR)
                {
                    ErrorBubble.ChangeInfoBubbleStateCommand.Execute(InfoBubbleViewModel.State.Minimized);
                }
            }
            else
            {
                if (!dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Errors.Contains(this.ErrorBubble))
                {
                    return;
                }

                Point topLeft  = new Point(NodeModel.X, NodeModel.Y);
                Point botRight = new Point(NodeModel.X + NodeModel.Width, NodeModel.Y + NodeModel.Height);
                InfoBubbleViewModel.Style style = InfoBubbleViewModel.Style.ErrorCondensed;
                // NOTE!: If tooltip is not cached here, it will be cleared once the dispatcher is invoked below
                string content = NodeModel.ToolTipText;
                InfoBubbleViewModel.Direction connectingDirection = InfoBubbleViewModel.Direction.Bottom;
                InfoBubbleDataPacket          data = new InfoBubbleDataPacket(style, topLeft, botRight, content, connectingDirection);

                this.ErrorBubble.UpdateContentCommand.Execute(data);
                this.ErrorBubble.ChangeInfoBubbleStateCommand.Execute(InfoBubbleViewModel.State.Pinned);
            }
        }
예제 #5
0
        private void UpdatePreviewBubbleContent(bool forceDataQuery)
        {
            if (PreviewBubble == null || NodeModel is Watch || dynSettings.Controller == null)
            {
                return;
            }

            var vm = dynSettings.Controller.DynamoViewModel;

            if (!vm.CurrentSpaceViewModel.Previews.Contains(PreviewBubble))
            {
                return;
            }

            if (PreviewBubble.InfoBubbleState == InfoBubbleViewModel.State.Minimized)
            {
                if (forceDataQuery == false)
                {
                    return;
                }
            }

            //create data packet to send to preview bubble
            const InfoBubbleViewModel.Style style = InfoBubbleViewModel.Style.PreviewCondensed;
            string content = OldValue;
            const InfoBubbleViewModel.Direction connectingDirection = InfoBubbleViewModel.Direction.Top;
            var data = new InfoBubbleDataPacket(style, GetTopLeft(), GetBotRight(), content, connectingDirection);

            PreviewBubble.UpdateContentCommand.Execute(data);
        }
예제 #6
0
 public InfoBubbleDataPacket(InfoBubbleViewModel.Style style, Point topLeft, Point botRight,
     string text, InfoBubbleViewModel.Direction connectingDirection)
 {
     Style = style;
     TopLeft = topLeft;
     BotRight = botRight;
     Text = text;
     ConnectingDirection = connectingDirection;
 }
예제 #7
0
 public InfoBubbleDataPacket(InfoBubbleViewModel.Style style, Point topLeft, Point botRight,
                             string text, InfoBubbleViewModel.Direction connectingDirection)
 {
     Style               = style;
     TopLeft             = topLeft;
     BotRight            = botRight;
     Text                = text;
     ConnectingDirection = connectingDirection;
 }
예제 #8
0
 public InfoBubbleDataPacket(
     InfoBubbleViewModel.Style style,
     Point topLeft,
     Point botRight,
     string text,
     InfoBubbleViewModel.Direction connectingDirection)
 {
     Style               = style;
     TopLeft             = topLeft;
     BotRight            = botRight;
     Link                = ParseLinkFromText(text);
     Text                = RemoveLinkFromText(text);
     ConnectingDirection = connectingDirection;
 }
예제 #9
0
        private void SetupAndShowTooltip(UIElement sender, InfoBubbleViewModel.Direction direction)
        {
            string content      = "";
            double actualWidth  = 0;
            double actualHeight = 0;

            switch (direction)
            {
            case InfoBubbleViewModel.Direction.Bottom:
                TextBlock tb = sender as TextBlock;
                content = ViewModel.Description;
                if (string.IsNullOrWhiteSpace(content))
                {
                    return;
                }

                actualWidth  = tb.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom;
                actualHeight = tb.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom;
                break;

            case InfoBubbleViewModel.Direction.Left:
            case InfoBubbleViewModel.Direction.Right:
                ContentPresenter nodePort = sender as ContentPresenter;
                content = (nodePort.Content as PortViewModel).ToolTipContent;
                if (string.IsNullOrWhiteSpace(content))
                {
                    return;
                }

                actualWidth  = nodePort.ActualWidth * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom;
                actualHeight = nodePort.ActualHeight * dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.Zoom;
                break;
            }

            UIElement containingWorkspace = WPF.FindUpVisualTree <TabControl>(this);

            InfoBubbleDataPacket data = new InfoBubbleDataPacket();

            data.Text                = content;
            data.Style               = InfoBubbleViewModel.Style.NodeTooltip;
            data.TopLeft             = sender.TranslatePoint(new Point(0, 0), containingWorkspace);
            data.BotRight            = new Point(data.TopLeft.X + actualWidth, data.TopLeft.Y + actualHeight);
            data.ConnectingDirection = direction;

            StartDelayedTooltipFadeIn(data);
        }