Exemplo n.º 1
0
        private void removeOutdateDanmaku(string _UniqueName)
        {
            OutlinedTextBlock _targetDanmaku = BindingCanvas.FindName(_UniqueName) as OutlinedTextBlock;

            if (_targetDanmaku != null)
            {
                BindingCanvas.Children.Remove(_targetDanmaku);
                BindingCanvas.UnregisterName(_UniqueName);
                _targetDanmaku = null;
            }
        }
Exemplo n.º 2
0
        private void AddR2LAnimation(string _UniqueName, Duration AppearDuration)
        {
            OutlinedTextBlock _targetDanmaku = BindingCanvas.FindName(_UniqueName) as OutlinedTextBlock;

            double          _danmakuWidth    = _targetDanmaku.ActualWidth;
            DoubleAnimation _doubleAnimation = new DoubleAnimation(BindingCanvas.ActualWidth, -_danmakuWidth, AppearDuration, FillBehavior.Stop);

            //Storyboard _sb = new Storyboard();
            //Storyboard.SetTarget(_doubleAnimation, _targetDanmaku);
            //Storyboard.SetTargetProperty(_doubleAnimation, mCache_R2LPropertyPath);
            _doubleAnimation.Completed += delegate(object o, EventArgs e) { removeOutdateDanmaku(_targetDanmaku.Name); };
            _targetDanmaku.BeginAnimation(Canvas.LeftProperty, _doubleAnimation);


            //_sb.Completed += delegate (object o, EventArgs e) { removeOutdateDanmaku(_targetDanmaku.Name); };

            //_sb.Children.Add(_doubleAnimation);
            //_sb.Begin();
        }