Exemple #1
0
        public void Show(Point location)
        {
            if (!Validate(location))
            {
                return;
            }

            Destroy.Disposable(ref timeout);
            Destroy.Disposable(ref tipInfo);

            timeout           = new System.Timers.Timer();
            timeout.AutoReset = false;
            timeout.Enabled   = true;
            timeout.Interval  = 500;
            timeout.Elapsed  += (s, ev) =>
            {
                Destroy.Disposable(ref timeout);
                Destroy.Disposable(ref tipInfo);

                var elem = _selectionResolver.GetElementFromLocation(location);

                if (elem != null)
                {
                    tipInfo = new ToolTip
                    {
                        AutomaticDelay = 0,
                        AutoPopDelay   = 0,
                        InitialDelay   = 0,
                        ReshowDelay    = 0,
                        ToolTipIcon    = ToolTipIcon.Info,
                        UseFading      = true,

                        ToolTipTitle = elem.Id
                    };

                    string text   = GetElementText(elem);
                    Action action = () => tipInfo?.Show(text, _controlToToolTip);

                    if (_controlToToolTip.InvokeRequired)
                    {
                        _controlToToolTip.Invoke(action);
                    }
                    else
                    {
                        action();
                    }

                    lastToolTipLocation = location;
                }
            };

            timeout.Start();
        }
        public void Show(Position position)
        {
            if (!Validate(position))
            {
                return;
            }

            Destroy.Disposable(ref timeout);
            Destroy.Disposable(ref tipInfo);

            timeout = new System.Timers.Timer
            {
                AutoReset = false,
                Enabled   = true,
                Interval  = 500
            };

            timeout.Elapsed += (s, ev) =>
            {
                Destroy.Disposable(ref timeout);
                Destroy.Disposable(ref tipInfo);

                var elem = _selectionResolver.GetElementFromLocation(position);

                if (elem != null)
                {
                    tipInfo = new ToolTip
                    {
                        AutomaticDelay = 0,
                        AutoPopDelay   = 0,
                        InitialDelay   = 0,
                        ReshowDelay    = 0,
                        ToolTipIcon    = ToolTipIcon.Info,
                        UseFading      = true,

                        ToolTipTitle = elem.Id
                    };

                    string text = GetElementText(elem);
                    _invoker.SafeInvoke(() => tipInfo?.Show(text, _controlToToolTip));

                    lastToolTipLocation = position;
                }
            };

            timeout.Start();
        }
        private async Task RedrawInternalAsync(Func <Gdi.Graphics, LayerSizesPreCalc, Task> drawLayersAction)
        {
            if (!ValidateInputLayer())
            {
                this.ControlCanvas.SetBlank();
            }
            else
            {
                var graphAndImage = this.ControlCanvas.GetGraphics();

                await drawLayersAction(graphAndImage.Graph, graphAndImage.LayerSizes);

                this.ControlCanvas.Image = graphAndImage.Image;

                Destroy.Disposable(ref graphAndImage.Graph);
            }
        }
Exemple #4
0
 public void Hide()
 {
     Destroy.Disposable(ref timeout);
     Destroy.Disposable(ref tipInfo);
 }