当前位置: 首页>>代码示例>>C#>>正文


C# Storyboard.Remove方法代码示例

本文整理汇总了C#中System.Windows.Media.Animation.Storyboard.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Storyboard.Remove方法的具体用法?C# Storyboard.Remove怎么用?C# Storyboard.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.Animation.Storyboard的用法示例。


在下文中一共展示了Storyboard.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SmoothSetAsync

        public static Task SmoothSetAsync(this FrameworkElement @this, DependencyProperty dp, double targetvalue,
            TimeSpan iDuration, CancellationToken iCancellationToken)
        {
            TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
            DoubleAnimation anim = new DoubleAnimation(targetvalue, new Duration(iDuration));
            PropertyPath p = new PropertyPath("(0)", dp);
            Storyboard.SetTargetProperty(anim, p);
            Storyboard sb = new Storyboard();
            sb.Children.Add(anim);
            EventHandler handler = null;
            handler = delegate
            {
                sb.Completed -= handler;
                sb.Remove(@this);
                @this.SetValue(dp, targetvalue);
                tcs.TrySetResult(null);
            };
            sb.Completed += handler;
            sb.Begin(@this, true);

            iCancellationToken.Register(() =>
            {
                double v = (double)@this.GetValue(dp);  
                sb.Stop(); 
                sb.Remove(@this); 
                @this.SetValue(dp, v);
                tcs.TrySetCanceled();
            });

            return tcs.Task;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:FrameworkElementExtender.cs

示例2: Invoke

    /// <summary>
    ///     Called when it's time to execute this storyboard action
    /// </summary> 
    internal override void Invoke( FrameworkElement containingFE, FrameworkContentElement containingFCE, Storyboard storyboard )
    { 
        Debug.Assert( containingFE != null || containingFCE != null, 
            "Caller of internal function failed to verify that we have a FE or FCE - we have neither." );
 
        if( containingFE != null )
        {
            storyboard.Remove(containingFE);
        } 
        else
        { 
            storyboard.Remove(containingFCE); 
        }
    } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:17,代码来源:RemoveStoryboard.cs

示例3: StepFiveControl

 public StepFiveControl(MainWindow window)
 {
     InitializeComponent();
     countdownControl.Initial(200, 170, 200,60);
     countdownControl.CountdownCompleted += () => {
         countdownControl.Visibility = Visibility.Collapsed;
         PlaySound();
     };
     sb = Resources["sb1"] as Storyboard;
     media.MediaEnded += OnSceneOver;
     media.MediaFailed += (sender, args) =>
     {
         _isMediaPlaying = false;
     };
     media.MediaOpened += (s, e) =>
     {
         //Panel.SetZIndex(media, 999);
         //border.Visibility = Visibility.Collapsed;
         //media.Opacity = 1;
         sb.Begin(media, true);
     };
     sb.Completed += (s, e) =>
     {
         sb.Remove(media);
         media.Opacity = 1;
     };
     Window = window;
 }
开发者ID:JacindaChen,项目名称:TronCell,代码行数:28,代码来源:StepFiveControl.xaml.cs

示例4: Show

 public void Show()
 {
     XGrid.OpacityMask = this.Resources["OpenBrush"] as LinearGradientBrush;
     _stb = this.Resources["OpenBoard"] as Storyboard;
     _stb.Completed += (s, e) =>
     {
         if (_stb == null)
             return;
         _stb.Remove();
         _stb = null;
         XGrid.OpacityMask = null;
         _mainWindow.StateSwitch(State.Setting);
     };
     _stb.Begin();
 }
开发者ID:DrLai12club,项目名称:BingWallpaper,代码行数:15,代码来源:SettingControl.xaml.cs

示例5: Hide

 public void Hide()
 {
     XGrid.OpacityMask = this.Resources["CloseBrush"] as LinearGradientBrush;
     _stb = this.Resources["CloseBoard"] as Storyboard;
     _stb.Completed += (s, e) =>
     {
         if (_stb == null)
             return;
         _stb.Remove();
         _stb = null;
         XGrid.OpacityMask = this.Resources["OpenBrush"] as LinearGradientBrush;
         SettingInstant.Save();
         _mainWindow.StateSwitch(State.Normal);
     };
     _stb.Begin();
 }
开发者ID:DrLai12club,项目名称:BingWallpaper,代码行数:16,代码来源:SettingControl.xaml.cs

示例6: SmoothSet

 public static void SmoothSet(this FrameworkElement @this, DependencyProperty dp, double targetvalue, TimeSpan iDuration)
 {
     DoubleAnimation anim = new DoubleAnimation(targetvalue, new Duration(iDuration));
     PropertyPath p = new PropertyPath("(0)", dp);
     Storyboard.SetTargetProperty(anim, p);
     Storyboard sb = new Storyboard();
     sb.Children.Add(anim);
     EventHandler handler = null;
     handler = delegate
     {
         sb.Completed -= handler;
         sb.Remove(@this);
         @this.SetValue(dp, targetvalue);
     };
     sb.Completed += handler;
     sb.Begin(@this, true);
 }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:17,代码来源:FrameworkElementExtender.cs

示例7: StoryboardBasicTest

        public void StoryboardBasicTest()
        {
            DoubleAnimation widthAnimation = new DoubleAnimation { To = 100 };
            DoubleAnimation heightAnimation = new DoubleAnimation { From = 100 };

            Storyboard storyboard = new Storyboard();
            storyboard.Children.Add(widthAnimation);
            storyboard.Children.Add(heightAnimation);

            FrameworkElement element = new FrameworkElement { Width = 0, Height = 0 };

            Storyboard.SetTarget(widthAnimation, element);
            Storyboard.SetTargetProperty(widthAnimation, PropertyPath.FromDependencyProperty(FrameworkElement.WidthProperty));

            Storyboard.SetTarget(heightAnimation, element);
            Storyboard.SetTargetProperty(heightAnimation, PropertyPath.FromDependencyProperty(FrameworkElement.HeightProperty));

            TestRootClock rootClock = new TestRootClock();
            element.SetAnimatableRootClock(new AnimatableRootClock(rootClock, true));
            storyboard.Begin(element);

            rootClock.Tick(TimeSpan.FromSeconds(0));
            Assert.AreEqual(0, element.Width);
            Assert.AreEqual(100, element.Height);

            rootClock.Tick(TimeSpan.FromSeconds(0.1));
            Assert.AreEqual(10, element.Width);
            Assert.AreEqual(90, element.Height);

            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(100, element.Width);
            Assert.AreEqual(0, element.Height);

            storyboard.Seek(element, TimeSpan.FromSeconds(0.5));
            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(50, element.Width);
            Assert.AreEqual(50, element.Height);

            storyboard.Remove(element);
            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(0, element.Width);
            Assert.AreEqual(0, element.Height);
        }
开发者ID:highzion,项目名称:Granular,代码行数:43,代码来源:StoryboardTest.cs

示例8: StepOneControl

 public StepOneControl(MainWindow window)
 {
     InitializeComponent();
     sb = Resources["sb1"] as Storyboard;
     timer.Interval = new TimeSpan(0, 0, Appconfig.AutoPlayInterval);
     timer.Tick += timer_Tick;
     timer.Start();
     media.MediaEnded += OnSceneOver;
     media.MediaFailed += (sender, args) =>
     {
         _isMediaPlaying = false;
     };
     media.MediaOpened += (s, e) =>
     {
         //Panel.SetZIndex(media, 999);
         //border.Visibility = Visibility.Collapsed;
         //media.Opacity = 1;
         sb.Begin(media, true);
     };
     sb.Completed += (s, e) =>
     {
         sb.Remove(media);
         media.Opacity = 1;
     };
     Window = window;
     ElementAnimControl.LeftCount = new int[7] { 4, 3, 3, 3, 3, 3, 3 };
     ElementAnimControl.RightCount = new int[7] { 3, 3, 3, 3, 3, 3, 4 };
     ElementAnimControl.Initial(Appconfig.TiltImagesDirName);
     ElementAnimControl.PlayRightNextPage += i =>
     {
         HandOption.Instance.Page1State = HandDirection.R;
         window.Pause();
         _isMediaPlaying = true;
         ShowMedia();
     };
     ElementAnimControl.PlayLeftNextPage += i =>
     {
         HandOption.Instance.Page1State = HandDirection.L;
         window.Pause();
         _isMediaPlaying = true;
         ShowMedia();
     };
 }
开发者ID:JacindaChen,项目名称:TronCell,代码行数:43,代码来源:StepOneControl.xaml.cs

示例9: btn_newGame_Click

        /*******************************************************************************************
         * btn_newGame_Click
         * - Função iniciar novo jogo
        *******************************************************************************************/
        private void btn_newGame_Click(object sender, RoutedEventArgs e)
        {
            storyboard = this.TryFindResource("luckyNum_anim") as Storyboard;

            storyboard.Remove(luckyRouletteNum);
            /*
            foreach (Image chip in winningChips_list)
            {
                storyboard.Stop(chip);
            }

            storyboard.SkipToFill();
            */

            clearBets();
            btn_newGame.Visibility = Visibility.Hidden;
            bola.Visibility = Visibility.Hidden;
            openTable.IsEnabled = true;
            chipGrid.IsEnabled = true;
            lbl_hint.Content = "Selecione a ficha para apostar!";
        }
开发者ID:nrage86,项目名称:Roleta,代码行数:25,代码来源:Roleta.xaml.cs

示例10: LoadRightImage

 public void LoadRightImage()
 {
     Image2.Source = new BitmapImage(new Uri(_imagePathList[_current - 1], UriKind.RelativeOrAbsolute));
     Image1.OpacityMask = this.Resources["CloseBrush"] as LinearGradientBrush;
     _stb = this.Resources["CloseBoard"] as Storyboard;
     _stb.Completed += (s, e) =>
     {
         if (_stb == null)
             return;
         _stb.Remove();
         _stb = null;
         Image1.Source = Image2.Source;
         Image1.OpacityMask = null;
         _current--;
         _mainWindow.StateSwitch(State.Normal);
         _mainWindow.CheckButton();
     };
     _stb.Begin();
 }
开发者ID:DrLai12club,项目名称:BingWallpaper,代码行数:19,代码来源:ImageControl.xaml.cs

示例11: PanelLayoutUpdated

        void PanelLayoutUpdated(object sender, EventArgs e)
        {
            // At this point, the panel has moved the children to the new locations, but hasn't

              // been rendered

              foreach (UIElement child in _panel.Children)
              {

              // Figure out where child actually is right now. This is a combination of where the

              // panel put it and any render transform currently applied

            //  Point currentPosition = child.TransformToAncestor(_panel).Transform(new Point());
             Vector vectorNow =  VisualTreeHelper.GetOffset(child);
             Point currentPosition = new Point(vectorNow.X, vectorNow.Y);

              // See what transform is being applied

              Transform currentTransform = child.RenderTransform;

              // Compute where the panel actually arranged it to

              Point arrangePosition = currentPosition;

              // If we had previously stored an arrange position, see if it has moved

              if (child.GetValue(PreviousRectProperty) != DependencyProperty.UnsetValue)
              {
                  var savedRect = PanelAnimation.GetPreviousRect(child);

                  Point savedArrangePosition = savedRect.TopLeft;

                  // If the arrange position hasn't changed, then we've already set up animations, etc

                  // and don't need to do anything

                  if (!AreReallyClose(savedArrangePosition, arrangePosition))
                  {

                      // If we apply the current transform to the saved arrange position, we'll see where

                      // it was last rendered

                     // Point lastRenderPosition = currentTransform.Transform(savedArrangePosition);

                      Point lastRenderPosition = savedArrangePosition;

                      // Transform the child from the new location back to the old position

                      TranslateTransform newTransform = new TranslateTransform();

                      child.RenderTransform = newTransform;

                      Storyboard transition = new Storyboard();
                      var xAnimation = MakeAnimation(lastRenderPosition.X - arrangePosition.X);
                      var yAnimation = MakeAnimation(lastRenderPosition.Y - arrangePosition.Y);

                      Storyboard.SetTarget(xAnimation, child);
                      Storyboard.SetTargetProperty(xAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
                     // Storyboard.SetTarget(child, xAnimation);

                      Storyboard.SetTarget(yAnimation, child);
                      Storyboard.SetTargetProperty(yAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
                    //  Storyboard.SetTarget( yAnimation);
                      transition.Children.Add(xAnimation);
                      transition.Children.Add(yAnimation);
                      transition.Duration = TimeSpan.FromMilliseconds(1000);
                      transition.Completed += (s, ev) => {
                       // transition.be
                          transition.Remove();
                      };
                      transition.Begin((FrameworkElement)child,true);

                      //transition.Children.Add()

                      // Decay the transformation with an animation

                    //  newTransform.BeginAnimation(TranslateTransform.XProperty, MakeAnimation(lastRenderPosition.X - arrangePosition.X));

            //                      newTransform.BeginAnimation(TranslateTransform.YProperty, MakeAnimation(lastRenderPosition.Y - arrangePosition.Y));

                  }

              }

              // Save off the previous arrange position

            //  child.SetValue(SavedArrangePositionProperty, arrangePosition);
              PanelAnimation.SetPreviousRect(child, new Rect(arrangePosition, child.DesiredSize));

              }
        }
开发者ID:huanshifeichen,项目名称:Codelib,代码行数:93,代码来源:PanelAnimation.cs

示例12: TrySetVerticalOffset

        private bool TrySetVerticalOffset(double offset)
        {
            if (_IsScrolling)
                return false;

            _IsScrolling = true;

            double oldoff = VerticalOffset;
            double newoffset = CalculateVerticalOffset(offset);

            double delta = Math.Abs(oldoff - newoffset);

            if (delta == 0)
            {
                _IsScrolling = false;
                return false;
            }

            if (delta > ViewportHeight)
            {
                VerticalOffset = newoffset;
                if (ScrollOwner != null)
                    ScrollOwner.InvalidateScrollInfo();
 
                _IsScrolling = false;
                _ScrollingOffset = 0;
                InvalidateMeasure();
               
            }
            else
            {
                double deltatrans =  (oldoff - newoffset) * ItemHeight;
                DoubleAnimation anim = new DoubleAnimation(deltatrans, new Duration(TimeToTransition));
                PropertyPath p = new PropertyPath("(0).(1)", RenderTransformProperty, TranslateTransform.YProperty);
                Storyboard.SetTargetProperty(anim, p);
                Storyboard sb = new Storyboard();
                sb.Children.Add(anim);
                EventHandler handler = null;
                handler = delegate
                {
                    sb.Completed -= handler;
                    sb.Remove(this);
                    _transform.Y = deltatrans;
                    VerticalOffset = newoffset;

                    _IsScrolling = false;
                    _ScrollingOffset = 0;

                    InvalidateMeasure();
                    //_transform.X = 0;

                    if (ScrollOwner != null)
                        ScrollOwner.InvalidateScrollInfo();
                };
                sb.Completed += handler;
                _IsScrolling = true;

                if (oldoff - newoffset > 0)
                    _ScrollingOffset = (int)(newoffset - oldoff);

                VerticalOffset = newoffset;
                InvalidateMeasure();

                Action Ba = () => sb.Begin(this, true);
                this.Dispatcher.BeginInvoke(Ba, DispatcherPriority.Input);
            }
            return true;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:68,代码来源:VerticalVirtualizingStackPanel_Scrolling.cs

示例13: FlyingGet

        private void FlyingGet(List<Card.Ruban> rubans,
            double x1, double y1, double x2, double y2, bool fade)
        {
            //<Canvas x:Name="cardLock" Canvas.Left="80" Canvas.Top="90"
            // Width="450" Height="125" Background="LightCoral"/>
            Canvas flyingBody = new Canvas() { Width = 450, Height = 125 };
            //flyingBody.Background = new SolidColorBrush(Colors.LightCoral);
            Canvas.SetLeft(flyingBody, x1);
            Canvas.SetTop(flyingBody, y1);
            flyingBody.Visibility = Visibility.Visible;
            // Clear Tux
            int sz = rubans.Count;
            for (int i = 0; i < sz; ++i)
            {
                rubans[i].Index = i;
                Canvas.SetLeft(rubans[i], i * 30);
                flyingBody.Children.Add(rubans[i]);
            }
            lock (aniCanvas.Children)
            {
                aniCanvas.Children.Add(flyingBody);
            }
            DoubleAnimation aniAppr = new DoubleAnimation() { From = 0, To = 1, Duration = SURA };
            Storyboard.SetTarget(aniAppr, flyingBody);
            Storyboard.SetTargetProperty(aniAppr, new PropertyPath(UIElement.OpacityProperty));
            aniAppr.BeginTime = TimeSpan.FromSeconds(0);

            DoubleAnimation aniX = new DoubleAnimation() { From = x1, To = x2, Duration = DURA };
            Storyboard.SetTarget(aniX, flyingBody);
            Storyboard.SetTargetProperty(aniX, new PropertyPath(Canvas.LeftProperty));
            aniX.BeginTime = SURA;

            DoubleAnimation aniY = new DoubleAnimation() { From = y1, To = y2, Duration = DURA };
            Storyboard.SetTarget(aniY, flyingBody);
            Storyboard.SetTargetProperty(aniY, new PropertyPath(Canvas.TopProperty));
            aniY.BeginTime = SURA;

            Storyboard sb = new Storyboard();
            sb.Children.Add(aniAppr);
            sb.Children.Add(aniX);
            sb.Children.Add(aniY);

            if (fade)
            {
                DoubleAnimation aniFade = new DoubleAnimation() { From = 1, To = 0, Duration = SURA };
                Storyboard.SetTarget(aniFade, flyingBody);
                Storyboard.SetTargetProperty(aniFade, new PropertyPath(UIElement.OpacityProperty));
                aniFade.BeginTime = SURA + DURA;
                sb.Children.Add(aniFade);
            }

            sb.Begin();
            new Thread(delegate()
            {
                if (fade)
                    Thread.Sleep(SURA + DURA + SURA);
                else
                    Thread.Sleep(SURA + DURA);
                aniCanvas.Dispatcher.BeginInvoke((Action)(() =>
                {
                    lock (aniCanvas.Children)
                    {
                        aniCanvas.Children.Remove(flyingBody);
                    }
                    sb.Remove();
                }));
            }).Start();
        }
开发者ID:palome06,项目名称:psd48,代码行数:68,代码来源:Orchis40.xaml.cs

示例14: FlyingShow

        private void FlyingShow(List<Card.Ruban> rubans, double x, double y, bool isLong)
        {
            Canvas flyingBody = new Canvas() { Width = 450, Height = 125 };
            Canvas.SetLeft(flyingBody, x);
            Canvas.SetTop(flyingBody, y);
            flyingBody.Visibility = Visibility.Visible;
            // Clear Tux
            int sz = rubans.Count;
            for (int i = 0; i < sz; ++i)
            {
                rubans[i].Index = i;
                Canvas.SetLeft(rubans[i], i * 30);
                flyingBody.Children.Add(rubans[i]);
            }
            lock (aniCanvas.Children)
            {
                aniCanvas.Children.Add(flyingBody);
            }
            TimeSpan holdDura = isLong ? LDURA : DURA;
            DoubleAnimation aniAppr = new DoubleAnimation() { From = 0, To = 1, Duration = SURA };
            Storyboard.SetTarget(aniAppr, flyingBody);
            Storyboard.SetTargetProperty(aniAppr, new PropertyPath(UIElement.OpacityProperty));
            aniAppr.BeginTime = TimeSpan.FromSeconds(0);

            DoubleAnimation aniFade = new DoubleAnimation() { From = 1, To = 0, Duration = SURA };
            Storyboard.SetTarget(aniFade, flyingBody);
            Storyboard.SetTargetProperty(aniFade, new PropertyPath(UIElement.OpacityProperty));
            aniFade.BeginTime = SURA + holdDura;

            Storyboard sb = new Storyboard();
            sb.Children.Add(aniAppr);
            sb.Children.Add(aniFade);

            sb.Begin();
            new Thread(delegate()
            {
                Thread.Sleep(SURA + holdDura + SURA);
                aniCanvas.Dispatcher.BeginInvoke((Action)(() =>
                {
                    lock (aniCanvas.Children)
                    {
                        aniCanvas.Children.Remove(flyingBody);
                    }
                    sb.Remove();
                }));
            }).Start();
        }
开发者ID:palome06,项目名称:psd48,代码行数:47,代码来源:Orchis40.xaml.cs

示例15: PushMessage

        private void PushMessage()
        {
            if (_IsChanging)
                return;

            if (_Queue.Count==0)
                return;
      
            _IsChanging = true;
      
            _Next = _Queue.Dequeue();
            Next.Content = _Next;

            Storyboard sb = new Storyboard();

            DoubleAnimation db = new DoubleAnimation();
            db.From = 0;
            db.To = -30;
            db.Duration = TransitionTime;

            Storyboard.SetTarget(db, this.Panel);
            Storyboard.SetTargetProperty(db, new PropertyPath("RenderTransform.Y"));

            sb.Children.Add(db);

            EventHandler handler = null;
            handler = delegate
            {
                Current.Content = Next.Content; 
                Transf.Y = 0;
                sb.Completed -= handler;
                sb.Remove();                       
                _IsChanging = false;
                PushMessage();
            };

            sb.Completed += handler;

            sb.Begin();
           
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:41,代码来源:Messager.xaml.cs


注:本文中的System.Windows.Media.Animation.Storyboard.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。