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


C# Storyboard.Stop方法代码示例

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


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

示例1: OnlineStatusControl

        public OnlineStatusControl()
        {
            InitializeComponent();
            story = new Storyboard();
            ColorAnimation animation1 = new ColorAnimation();
            Storyboard.SetTarget(animation1, ((RadialGradientBrush)this.ellipse.Fill).GradientStops[0]);
            Storyboard.SetTargetProperty(
               animation1, new PropertyPath(GradientStop.ColorProperty));
            animation1.Duration = new Duration(new TimeSpan(0, 0, 1)); ;
            animation1.To = Colors.White;
            story.Stop();
            story.Children.Add(animation1);

            ColorAnimation animation2 = new ColorAnimation();
            Storyboard.SetTarget(animation2, ((RadialGradientBrush)this.ellipse.Fill).GradientStops[1]);
            Storyboard.SetTargetProperty(
               animation2, new PropertyPath(GradientStop.ColorProperty));
            animation2.Duration = new Duration(new TimeSpan(0, 0, 1)); ;
            animation2.To = Common.MyColor.ConvertColor("#ff2ADC16");
            story.Stop();
            story.Children.Add(animation2);

            story.AutoReverse = true;
            story.RepeatBehavior = RepeatBehavior.Forever;
            this.LayoutRoot.Resources.Add("sotry_", story);

            OnlineStatus = 1;
        }
开发者ID:dalinhuang,项目名称:my-un-code,代码行数:28,代码来源:OnlineStatusControl.xaml.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.Stop(containingFE);
        }
        else
        {
            storyboard.Stop(containingFCE);
        }
    }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:17,代码来源:StopStoryboard.cs

示例3: CameraItem

        public CameraItem()
        {
            InitializeComponent();
            panPicture = (Storyboard)TryFindResource("scaleandmove");

            EventHandler handler2 = null;
            handler2 = delegate
            {
                panPicture.Completed -= handler2;
                panPicture.Stop();
                camera_image.Opacity = 0;
                EventHandler handler3 = null;
                handler3 = delegate
                {
                    panPicture2.Completed -= handler3;
                    panPicture2.Stop();

                    TransformGroup trGrp = new TransformGroup();

                    TranslateTransform trTns = new TranslateTransform(-80.5, -3.389); ;
                    ScaleTransform trScl = new ScaleTransform(1.293, 1.293);

                    trGrp.Children.Add(trTns);
                    trGrp.Children.Add(trScl);

                    camera_image2.RenderTransform = trGrp;
                    //CameraiTime.camera_image2.Opacity = 1;
                };
                panPicture2.Completed += handler3;
                panPicture2.Begin();

            };
            panPicture.Completed += handler2;
            panPicture2 = (Storyboard)TryFindResource("scale2");
        }
开发者ID:nokong,项目名称:Embassy,代码行数:35,代码来源:CameraItem.xaml.cs

示例4: ClosingWindow

        public void ClosingWindow()
        {
            //キーフレームで時間を区切る
            var frame0 = new EasingDoubleKeyFrame(this.Width,  KeyTime.FromTimeSpan(new TimeSpan(1)));
            var frame1 = new EasingDoubleKeyFrame(0,           KeyTime.FromTimeSpan(new TimeSpan(2500000)));
            var frame2 = new EasingDoubleKeyFrame(this.Height, KeyTime.FromTimeSpan(new TimeSpan(2500001)));
            var frame3 = new EasingDoubleKeyFrame(0,           KeyTime.FromTimeSpan(new TimeSpan(5000000)));
            //キーフレームをアニメーションとしてまとめる
            var animationWidth = new DoubleAnimationUsingKeyFrames();
            animationWidth.KeyFrames.Add(frame0);
            animationWidth.KeyFrames.Add(frame1);
            //アニメーションをアニメーションさせたいオブジェクトクラスのプロパティにひもづける
            //...ということはオブジェクト毎にアニメーションさせるのはだめ?
            Storyboard.SetTargetName(animationWidth, this.Name);
            Storyboard.SetTargetProperty(animationWidth, new PropertyPath(MainWindow.WidthProperty));

            var animationHeight = new DoubleAnimationUsingKeyFrames();
            animationHeight.KeyFrames.Add(frame2);
            animationHeight.KeyFrames.Add(frame3);
            Storyboard.SetTargetName(animationHeight, this.Name);
            Storyboard.SetTargetProperty(animationHeight, new PropertyPath(MainWindow.HeightProperty));

            //静的にひもづけられたストーリーボードへアニメーションを登録する
            myStoryboard = new Storyboard();
            myStoryboard.Completed += new EventHandler(endAnimation);
            myStoryboard.Children.Add(animationWidth);
            myStoryboard.Children.Add(animationHeight);
            //アニメーションを実行する
            myStoryboard.Begin(this);

            myStoryboard.Stop();
        }
开发者ID:popesan,项目名称:AlertPSO2EmergencyQuest,代码行数:32,代码来源:MainWindow.xaml.cs

示例5: ButtonSave_Click

        void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            Storyboard sb = new Storyboard();
            sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); });
            Storyboard.SetTarget(sb, ButtonSaveTransform);
            sb.Begin();

            if (!string.IsNullOrEmpty(TextBoxDefaultWidth.Text))
                IsolatedStorageManager.SaveIntoIsolatedStorage("DefaultWidth", Convert.ToInt32(TextBoxDefaultWidth.Text));

            if (!string.IsNullOrEmpty(TextBoxDefaultHeight.Text))
                IsolatedStorageManager.SaveIntoIsolatedStorage("DefaultHeight", Convert.ToInt32(TextBoxDefaultHeight.Text));

            if (!string.IsNullOrEmpty(TextBoxMinimumWidth.Text))
                IsolatedStorageManager.SaveIntoIsolatedStorage("MinimumWidth", Convert.ToInt32(TextBoxMinimumWidth.Text));

            if (!string.IsNullOrEmpty(TextBoxMinimumHeight.Text))
                IsolatedStorageManager.SaveIntoIsolatedStorage("MinimumHeight", Convert.ToInt32(TextBoxMinimumHeight.Text));

            IsolatedStorageManager.SaveIntoIsolatedStorage("ResizeWithBrowser", CheckboxResizeWithBrowser.IsChecked);

            IsolatedStorageManager.SaveIntoIsolatedStorage("MaintainAspectRatio", CheckboxMaintainAspectRatio.IsChecked);

            IsolatedStorageManager.SaveIntoIsolatedStorage("ForceIPv4", CheckboxForceIPv4.IsChecked);

            if (!string.IsNullOrEmpty(TextBoxNumberOfMessagesOnMonitor.Text))
                IsolatedStorageManager.SaveIntoIsolatedStorage("NumberOfMessagesOnMonitor", Convert.ToInt32(TextBoxNumberOfMessagesOnMonitor.Text));

            LoadSettingsFromIsolatedStorage();

            SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Successfully Saved System Settings", SystemMessage = string.Empty, UserMessageType = MessageType.Success },
                        ButtonType.OkOnly);
            sm.ShowPopup();
        }
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:35,代码来源:SystemSettings.xaml.cs

示例6: 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

示例7: AnimateTranslateTransform

        /// <summary>
        /// Animates the translate transform object, responsible for displacement of the target.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="storyboard">The storyboard.</param>
        /// <param name="to">Animation's ending value.</param>
        /// <param name="seconds">Duration of the animation in seconds.</param>
        /// <param name="easingFunction">Easing function applied to the animation.</param>
        public static void AnimateTranslateTransform(this DependencyObject target, Storyboard storyboard, Point to,
            double seconds, IEasingFunction easingFunction = null)
        {
            Duration duration = new Duration(TimeSpan.FromSeconds(seconds));

            DoubleAnimation doubleAnimationX = new DoubleAnimation()
            {
                To = to.X,
                Duration = duration,
                EasingFunction = easingFunction
            };

            DoubleAnimation doubleAnimationY = new DoubleAnimation()
            {
                To = to.Y,
                Duration = duration,
                EasingFunction = easingFunction
            };

            storyboard.Stop();
            storyboard.Children.Clear();
            storyboard.Duration = duration;
            storyboard.Children.Add(doubleAnimationX);
            storyboard.Children.Add(doubleAnimationY);

            Storyboard.SetTarget(doubleAnimationX, target);
            Storyboard.SetTarget(doubleAnimationY, target);
            Storyboard.SetTargetProperty(doubleAnimationX, (target as UIElement).GetPropertyPathForTranslateTransformX());
            Storyboard.SetTargetProperty(doubleAnimationY, (target as UIElement).GetPropertyPathForTranslateTransformY());

            storyboard.Begin();
        }
开发者ID:Zoomicon,项目名称:ZUI,代码行数:40,代码来源:AnimationExtensions.cs

示例8: Button_Click

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //MainPanel.IsEnabled = false;

            _sb = new Storyboard();
            _sb.FillBehavior = FillBehavior.Stop;
            _sb.RepeatBehavior = RepeatBehavior.Forever;
            DoubleAnimationUsingKeyFrames da2 = new DoubleAnimationUsingKeyFrames();
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(30, TimeSpan.FromSeconds(0.1)));
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(60, TimeSpan.FromSeconds(0.2)));
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(90, TimeSpan.FromSeconds(0.3)));
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(120, TimeSpan.FromSeconds(0.4)));
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(150, TimeSpan.FromSeconds(0.5)));
            da2.KeyFrames.Add(new LinearDoubleKeyFrame(180, TimeSpan.FromSeconds(0.6)));
            Storyboard.SetTarget(da2, Button);
            Storyboard.SetTargetProperty(da2, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"));
            _sb.Children.Add(da2);
            _sb.Begin();

            //  延时打开DockWindow
            Thread t = new Thread(() =>
            {
                Thread.Sleep(3000);
                Dispatcher.Invoke(new Action(() =>
                {

                    if (userName.Text == "1")
                    {
                        _sb.Stop();
                        Close();
                        var dockView = new MainWindow();
                        dockView.ShowDialog();
                    }
                    else
                    {
                        _sb.Stop();
                        var errorWindow = new ErrorWindow();
                        errorWindow.ShowDialog();
                    }
                }));
            });

            t.Start();
        }
开发者ID:heyixiaoran,项目名称:NotifyUI,代码行数:44,代码来源:LoginView.xaml.cs

示例9: AddAnimationToStoryboard

 /// <summary>
 /// 向Storyboard添加动画
 /// </summary>
 /// <param name="sb">目标Storyboard</param>
 /// <param name="dobj">动画目标</param>
 /// <param name="property">被改变的值</param>
 /// <param name="to">动画完毕后的最终值</param>
 /// <param name="Duration">动画持续时间</param>
 /// <param name="eh">Storyboard完成事件处理程序</param>
 public void AddAnimationToStoryboard(Storyboard sb, DependencyObject dobj, string property, double to, TimeSpan Duration)
 {
     DoubleAnimation da = new DoubleAnimation();
     Storyboard.SetTarget(da, dobj);
     Storyboard.SetTargetProperty(da, new PropertyPath(property));
     da.To = to;
     da.Duration = new Duration(Duration);
     sb.Stop();
     sb.Children.Add(da);
 }
开发者ID:TheLegion96,项目名称:fightthelandlord,代码行数:19,代码来源:MainPage.xaml.cs

示例10: Show

        public void Show()
        {
            //2s之内连续按2次,退出
            if (clickCount > 0)
            {
                if (Completed != null)
                {
                    Completed(true);
                }
            }
            else
            {
                clickCount++;

                if (Completed != null)
                {
                    Completed(false);
                }

                var tips = new JMessboxControl();
                tips.TBMessage.Text = this.messageText;
                popup.Height = 65;
                popup.Width = 200;
                popup.Margin = new Thickness(140, 380, 0, 0);
                popup.IsOpen = false;
                popup.Child = tips;

                //渐变效果:透明度200毫秒内从0->1
                Storyboard story = new Storyboard();
                DoubleAnimation topAnimation = new DoubleAnimation();
                topAnimation.From = 0;
                topAnimation.To = 1;
                topAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(200));
                Storyboard.SetTarget(topAnimation, tips);
                Storyboard.SetTargetProperty(topAnimation, new PropertyPath("(UIElement.Opacity)"));

                story.Children.Add(topAnimation);

                popup.IsOpen = true;
                story.Begin();
                //动画延迟2秒
                story.Duration = new Duration(new TimeSpan(0, 0, 2));
                //story.BeginTime = new TimeSpan(0, 0, 0, 0, 1);
                story.Completed += (s1, e1) =>
                {
                    //2s后执行此方法
                    clickCount = 0;
                    popup.IsOpen = false;
                    story.Stop();
                };
            }

        }
开发者ID:jevonsflash,项目名称:Healthcare,代码行数:53,代码来源:JMessBox.cs

示例11: Shake

 /// <summary>
 /// 地震
 /// </summary>
 /// <param name="depth">深度</param>
 public void Shake(int depth)
 {
     Storyboard shakeStoryboard = new Storyboard() { AutoReverse = true };
     shakeStoryboard.Children.Add(GlobalMethod.CreateDoubleAnimation(thisTranslateTransform, "X", thisTranslateTransform.X + RandomSeed.Next(-depth, depth), TimeSpan.FromMilliseconds(40), new CubicEase() { EasingMode = EasingMode.EaseOut }));
     shakeStoryboard.Children.Add(GlobalMethod.CreateDoubleAnimation(thisTranslateTransform, "Y", thisTranslateTransform.Y + RandomSeed.Next(-depth, depth), TimeSpan.FromMilliseconds(40), new CubicEase() { EasingMode = EasingMode.EaseOut }));
     EventHandler handler = null;
     shakeStoryboard.Completed += handler = delegate {
         shakeStoryboard.Completed -= handler;
         shakeStoryboard.Stop();
     };
     shakeStoryboard.Begin();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:16,代码来源:EffectLayer.cs

示例12: ButtonSearch_Click

 void ButtonSearch_Click(object sender, RoutedEventArgs e)
 {
     #if SILVERLIGHT
     Storyboard sb = new Storyboard();
     sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard;
     sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); });
     Storyboard.SetTarget(sb, ButtonSearchTransform);
     sb.Begin();
     #endif
     string searchText = TextBoxSearch.Text.ToUpper();
     ListBoxOtherDeviceList.ItemsSource = (from item in m_otherDeviceList
                                           where item.Acronym.ToUpper().Contains(searchText) || item.Name.ToUpper().Contains(searchText) || item.InterconnectionName.ToUpper().Contains(searchText)
                                                  || item.CompanyName.ToUpper().Contains(searchText) || item.VendorDeviceName.ToUpper().Contains(searchText)
                                           select item).ToList();
 }
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:15,代码来源:OtherDevicesUserControl.xaml.cs

示例13: Run

 public override void Run(RoleBase caster, Space space, MagicArgs args)
 {
     double distance = GlobalMethod.GetDistance(args.Position, args.Destination);
     double speed = 2;
     caster.LinearShuttle(args.Destination, distance * speed);
     int count = 0;
     EventHandler timerHandler = null;
     DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(100) };
     timer.Tick += timerHandler = delegate {
         caster.Target = null;
         if (count == args.Number || caster.Action != Actions.Attack) {
             timer.Tick -= timerHandler;
             timer.Stop();
         } else {
             WriteableBitmap writeableBitmap = new WriteableBitmap((int)caster.OverallSize.X, (int)caster.OverallSize.Y);
             writeableBitmap.Render(caster.EquipEntity(EquipTypes.Overall), null);
             writeableBitmap.Invalidate();
             EntityObject chasingShadow = new EntityObject() {
                 RenderTransform = caster.RenderTransform,
                 ImageSource = writeableBitmap,
                 Center = caster.Center,
                 Position = caster.Position,
                 Z = caster.Z - 20
             };
             space.Children.Add(chasingShadow);
             Storyboard storyboard = new Storyboard();
             storyboard.Children.Add(GlobalMethod.CreateDoubleAnimation(chasingShadow,"Opacity",0.9,0,TimeSpan.FromMilliseconds(caster.HeartInterval * 3),null));
             EventHandler handler = null;
             storyboard.Completed += handler = delegate {
                 storyboard.Completed -= handler;
                 storyboard.Stop();
                 space.Children.Remove(chasingShadow);
             };
             storyboard.Begin();
             //每200毫秒伤害一次
             if (count % 2 == 0) {
                 for (int i = space.AllRoles().Count - 1; i >= 0; i--) {
                     RoleBase target = space.AllRoles()[i];
                     if (caster.IsHostileTo(target) && target.InCircle(caster.Position, args.Radius * args.Scale)) {
                         caster.CastingToEffect(target, args);
                     }
                 }
             }
             count++;
         }
     };
     timer.Start();
 }
开发者ID:Gallardot,项目名称:GallardotStorage,代码行数:48,代码来源:RoleLinearShuttleMagic.cs

示例14: ButtonClear_Click

        void ButtonClear_Click(object sender, RoutedEventArgs e)
        {
            Storyboard sb = new Storyboard();
            sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); });
            Storyboard.SetTarget(sb, ButtonClearTransform);
            sb.Begin();

            //Load Default Settings.
            ProxyClient.SetDefaultSystemSettings(true);
            LoadSettingsFromIsolatedStorage();

            SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Successfully Restored Default System Settings", SystemMessage = string.Empty, UserMessageType = MessageType.Success },
                        ButtonType.OkOnly);
            sm.ShowPopup();
        }
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:16,代码来源:SystemSettings.xaml.cs

示例15: ButtonSendServiceRequest_Click

 void ButtonSendServiceRequest_Click(object sender, RoutedEventArgs e)
 {
     #if SILVERLIGHT
     Storyboard sb = new Storyboard();
     sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard;
     sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); });
     Storyboard.SetTarget(sb, ButtonSendServiceRequestTransform);
     sb.Begin();
     #endif
     if (!string.IsNullOrEmpty(TextBoxServiceRequest.Text))
     {
         SendRequest();
         TextBoxServiceRequest.Focus();
         TextBoxServiceRequest.SelectAll();
     }
 }
开发者ID:JiahuiGuo,项目名称:openPDC,代码行数:16,代码来源:MonitorUserControl.xaml.cs


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