Esempio n. 1
0
        private async void Close()
        {
            IsHitTestVisible = false;

            _window.PreviewMouseDown -= OnWindowMouseDown;
            _window.PreviewKeyDown   -= OnWindowMouseDown;

            if (_hint.CloseOnResize)
            {
                _window.SizeChanged -= OnWindowSizeChanged;
            }

            var cell = GetByName("PART_Cell");

            if (cell != null)
            {
                VisibilityAnimation.SetVisible(cell, false);
                await Task.Delay(300);
            }

            _layer.Remove(this);
            IsAnyShown = false;
        }
Esempio n. 2
0
        private async void Show()
        {
            IsAnyShown = true;
            await Task.Delay(1);

            var cell = GetByName("PART_Cell");

            if (cell != null)
            {
                VisibilityAnimation.SetDuration(cell, TimeSpan.FromSeconds(0.3));
                VisibilityAnimation.SetVisible(cell, true);

                _window.PreviewMouseDown += OnWindowMouseDown;
                _window.PreviewKeyDown   += OnWindowKeyDown;

                if (_hint.CloseOnResize)
                {
                    _window.SizeChanged += OnWindowSizeChanged;
                }

                cell.PreviewMouseDown += OnMouseDown;

                var disableButton = GetByName("PART_DisableHintsButton") as Button;
                if (disableButton != null)
                {
                    disableButton.Command = new DelegateCommand(() => {
                        FancyHintsService.Instance.Enabled = false;
                        Close();
                    });
                }
            }
            else
            {
                IsAnyShown = false;
            }
        }