예제 #1
0
        public DropBehavior()
        {
            _blinkStopTimer.Elapsed += (s, e) =>
            {
                // do open
                Application.Current.Dispatcher.Invoke(() =>
                {
                    IDropable dropable = GetDropable();
                    if (dropable != null)
                    {
                        //if (dropable.CanOpen(_data, _target))
                        dropable.Open(_data, _target);
                    }
                    _blinkTimer.Stop();
                });
            };

            _blinkTimer.Elapsed += (s, e) =>
            {
                // flash
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (_uiElement != null)
                    {
                        _isOpening = !_isOpening;
                        RemoveAdorner();
                        MakeAdorner(_uiElement, _data, _target, _isOpening, _canDrop, _message);
                    }
                });
            };

            _openTimer.Elapsed += (s, e) =>
            {
                // user waited for open
                Application.Current.Dispatcher.Invoke(() =>
                {
                    IDropable dropable = GetDropable();
                    if (dropable != null)
                    {
                        if (dropable.CanOpen(_data, _target))
                        {
                            _blinkTimer.Start();
                            _blinkStopTimer.Start();
                        }
                    }
                });
            };
        }