コード例 #1
0
        private void SwitchPic(bool bNext)
        {
            if (bNext)
            {
                m_curIndex++;
            }
            else
            {
                m_curIndex--;
            }

            m_curIndex = m_curIndex % gifs.Length;

            if (m_curIndex < 0)
            {
                m_curIndex += gifs.Length;
            }

            var image = new BitmapImage();

            image.BeginInit();
            image.UriSource = new Uri(gifs[m_curIndex], UriKind.RelativeOrAbsolute);
            image.EndInit();

            ImageBehavior.SetAnimatedSource(img, image);

            _controller = ImageBehavior.GetAnimationController(img);

            if (_controller != null)
            {
                _controller.GotoFrame(0);
                _controller.Play();
            }
        }
コード例 #2
0
        private void Grid_MouseEnter_7(object sender, MouseEventArgs e)
        {
            ImageAnimationController c = ImageBehavior.GetAnimationController(liste);

            if (c != null)
            {
                c.Play();
            }
        }
コード例 #3
0
        private void Grid_MouseLeave(object sender, MouseEventArgs e)
        {
            ImageAnimationController c = ImageBehavior.GetAnimationController(arbre);

            if (c != null)
            {
                c.Pause();
            }
        }
コード例 #4
0
        private void SwitchGifPngAnimate(object sender, RoutedEventArgs e)
        {
            //洗版动画Gif图
            BitmapImage bitmapImage1 = new BitmapImage(new Uri("pack://application:,,,/Pr60_TestFunction;component/F02_ShowImage/GifImg/trending_animation_s1.gif"));
            Image       imgGif       = new Image();

            ImageBehavior.SetAnimatedSource(imgGif, bitmapImage1);
            ImageBehavior.SetRepeatBehavior(imgGif, new RepeatBehavior(1));
            grid30.Children.Add(imgGif);

            ImageAnimationController gifController = null;

            //******** GetAnimationController will return null if the animation is not yet fully loaded ***********
            ImageBehavior.AddAnimationLoadedHandler(imgGif, new RoutedEventHandler((s2, e2) =>
            {
                gifController = ImageBehavior.GetAnimationController(imgGif);
            }));


            //静态PNG图
            Image       imgPng       = new Image();
            BitmapImage bitmapImage2 = new BitmapImage(new Uri("pack://application:,,,/Pr60_TestFunction;component/F02_ShowImage/GifImg/text display_256x64_1.png"));

            imgPng.Source     = bitmapImage2;
            imgPng.Visibility = Visibility.Collapsed;
            grid30.Children.Add(imgPng);

            //计时器
            dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
            dispatcherTimer.Tick    += (object s3, EventArgs e3) =>
            {
                //grid30.Children[0].Visibility = Visibility.Visible;
                //grid30.Children[1].Visibility = Visibility.Collapsed;
                imgGif.Visibility = Visibility.Visible;
                imgPng.Visibility = Visibility.Collapsed;

                dispatcherTimer.Stop();

                gifController.GotoFrame(0);
                gifController.Play();
            };

            ImageBehavior.AddAnimationCompletedHandler(imgGif, new RoutedEventHandler((s1, e1) =>
            {
                //grid30.Children[0].Visibility = Visibility.Collapsed;
                //grid30.Children[1].Visibility = Visibility.Visible;
                imgGif.Visibility = Visibility.Collapsed;
                imgPng.Visibility = Visibility.Visible;

                //gifController.Pause();
                dispatcherTimer.Start();
            }));


            //dispatcherTimer.Tick += new EventHandler((object s3, EventArgs e3) => PngEnd(s3, e3));
            //ImageBehavior.AddAnimationCompletedHandler(imgGif, new RoutedEventHandler((object s1, RoutedEventArgs e1) => GifEnd(s1, e1)));
        }
コード例 #5
0
        private void Image_Loaded(object sender, RoutedEventArgs e)
        {
            _GIF_controller = ImageBehavior.GetAnimationController(Img_gif);
            i = _GIF_controller.FrameCount;
            int b = _GIF_controller.CurrentFrame;

            _GIF_controller.GotoFrame(1);
            _GIF_controller.Pause();
        }
コード例 #6
0
        private void btnStart_Unchecked(object sender, RoutedEventArgs e)
        {
            _controller = ImageBehavior.GetAnimationController(img);

            if (_controller != null)
            {
                _controller.Play();
            }

            btnPrev.Visibility = Visibility.Hidden;
            btnNext.Visibility = Visibility.Hidden;
        }
コード例 #7
0
 private void GifAppIconPause()
 {
     try
     {
         this.mGifController = ImageBehavior.GetAnimationController((Image)this.mAppImage);
         this.mGifController.Pause();
     }
     catch (Exception ex)
     {
         Logger.Warning("Failed to pause gif. Err : " + ex.Message);
     }
 }
コード例 #8
0
        private void btnStart_Checked(object sender, RoutedEventArgs e)
        {
            _controller = ImageBehavior.GetAnimationController(img);

            if (_controller != null)
            {
                _controller.Pause();
            }

            btnPrev.Visibility = Visibility.Visible;
            btnNext.Visibility = Visibility.Visible;

            btnPrev.IsEnabled = (m_curIndex != 0);
            btnNext.IsEnabled = (m_curIndex != gifs.Length - 1);
        }
コード例 #9
0
        private async void LoadClick(object sender, RoutedEventArgs e)
        {
            string input = searchBox_Textbox.Text;

            if (ContainsSpecialChars(input))
            {
                MessageBox.Show("Input can only contain numbers & alphanumeric characters");
                return;
            }

            // Server request
            ImageAnimationController controller = ImageBehavior.GetAnimationController(loadingGif_Image);

            controller.Play();

            Connection connection = new Connection();

            status_Textblock.Text = "Connecting...";
            await connection.Connect(Settings.Default.ServerIP, Settings.Default.ServerPort);

            status_Textblock.Text = "Connected";
            FileInfoRequest request = new FileInfoRequest(input);

            status_Textblock.Text = "Checking for file...";
            await connection.SendPacket(request);

            FileInfoResponse response = await connection.ReceivePacket() as FileInfoResponse;

            connection.Close();
            await Task.Delay(1000);

            status_Textblock.Text = "Got response...";
            controller.Pause();

            if (response != null && response.Exists)
            {
                DownloadWindow window = new DownloadWindow(response.File);
                window.Owner = this;
                window.Show();
                window.Closing += DownloadWindowClosing;

                windows.Add(window);
            }
            else
            {
                status_Textblock.Text = "Invalid response!";
            }
        }
コード例 #10
0
        private void Img_gif_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image obj = (Image)sender;

            obj.Opacity = 1;

            if (_GIF_controller != null)
            {
                //_GIF_controller = ImageBehavior.GetAnimationController(Img_gif);
                _GIF_controller.GotoFrame(1);
                _GIF_controller.Play();
            }
            else
            {
                _GIF_controller = ImageBehavior.GetAnimationController(Img_gif);
                _GIF_controller.GotoFrame(1);
                _GIF_controller.Play();
            }
        }
コード例 #11
0
 private void GifAppIconPlay()
 {
     try
     {
         this.mGifController = ImageBehavior.GetAnimationController((Image)this.mAppImage);
         if (this.mGifController != null)
         {
             this.mGifController.Play();
         }
         else
         {
             if (this.mAppIconModel.ImageName == null)
             {
                 return;
             }
             ImageBehavior.SetAnimatedSource((Image)this.mAppImage, (ImageSource) new BitmapImage(new Uri(this.mAppIconModel.ImageName)));
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Exception in animating appicon for package " + this.mAppIconModel.PackageName + Environment.NewLine + ex.ToString());
     }
 }
コード例 #12
0
 private void gif2_Cargado(object sender, RoutedEventArgs e)
 {
     controladorGif2 = ImageBehavior.GetAnimationController(image_Dado2);
 }
コード例 #13
0
        public void AnimatingControl_Loaded()
        {
            var imageToLoad = Int32.Parse(Application.Current.Properties["CurrentMovement"].ToString());

            if (imageToLoad >= _positionImageList.Count)
            {
                MainWindow window = new MainWindow();
                window.Show();
                Window.GetWindow(this).Close();
                return;
            }
            _currentImage = _allImages[_positionImageList[imageToLoad]];

            switch (_sizeValue)
            {
            case 0:
                //big
                _currentImage.Source = _currentImage.SourceBig;
                break;

            case 1:
                //mid
                _currentImage.Source = _currentImage.SourceMid;
                break;

            case 2:
                //small
                _currentImage.Source = _currentImage.SourceSmall;
                break;
            }
            var bitmap = new BitmapImage(new Uri(_currentImage.Source, UriKind.Relative));

            ImageToMove.Source = bitmap;
            ImageBehavior.SetAnimatedSource(ImageToMove, bitmap);
            Controller    = ImageBehavior.GetAnimationController(ImageToMove);
            ImageMovement = new Storyboard();
            GameWindow    = Window.GetWindow(this);
            var timeToMove         = Convert.ToInt32(Application.Current.Properties["Speed"].ToString());
            var movementToComplete = Int32.Parse(Application.Current.Properties["CurrentMovement"].ToString());
            var currentMovement    = _allMovementObjects[_positionList[movementToComplete]];

            if (currentMovement.Active)
            {
                DoubleAnimation horizontalMovement;
                DoubleAnimation verticalMovement;
                double          xStart;
                double          yStart;
                double          xEnd;
                double          yEnd;
                ImageToMove.Width      = bitmap.Width;
                ImageToMove.Height     = bitmap.Height;
                ImageToMove.Visibility = Visibility.Visible;
                switch (currentMovement.Type)
                {
                case MovementType.HorizontalLeftToRight:
                    FaceDirection(true);
                    xStart = 0;
                    xEnd   = GameWindow.ActualWidth + ImageToMove.Width;
                    yStart = (GameWindow.ActualHeight - ImageToMove.Height) / 2;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    break;

                case MovementType.HorizontalRightToLeft:
                    FaceDirection(false);

                    yStart = (GameWindow.ActualHeight - ImageToMove.Height) / 2;
                    xStart = GameWindow.ActualWidth - ImageToMove.Width;
                    xEnd   = 0 - ImageToMove.Width - 10;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    break;

                case MovementType.DiagonalUpLeftToDownRight:
                    FaceDirection(true);

                    xStart = 0;
                    yStart = 0;
                    xEnd   = GameWindow.ActualWidth;
                    yEnd   = GameWindow.ActualHeight;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.DiagonalDownRightToUpLeft:
                    FaceDirection(false);

                    xStart = GameWindow.ActualWidth - ImageToMove.Width;
                    yStart = GameWindow.ActualHeight - ImageToMove.Height;
                    xEnd   = 0 - ImageToMove.Width;
                    yEnd   = 0 - ImageToMove.Height;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.VerticalUpToDown:
                    xStart = (GameWindow.ActualWidth - ImageToMove.Width) / 2;
                    yStart = 0;
                    yEnd   = GameWindow.ActualHeight;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.VerticalDownToUp:
                    xStart = (GameWindow.ActualWidth - ImageToMove.Width) / 2;
                    yStart = GameWindow.ActualHeight - ImageToMove.Height;
                    yEnd   = 0 - ImageToMove.Height;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.DiagonalDownLeftToUpRight:
                    FaceDirection(true);
                    xStart = 0;
                    yStart = GameWindow.ActualHeight - ImageToMove.Height;
                    xEnd   = GameWindow.ActualWidth;
                    yEnd   = 0 - ImageToMove.Height;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.DiagonalUpRightToDownLeft:
                    FaceDirection(false);
                    xStart = GameWindow.ActualWidth - ImageToMove.Width;
                    yStart = 0;
                    xEnd   = 0 - ImageToMove.Width;
                    yEnd   = GameWindow.ActualHeight;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);
                    horizontalMovement = new DoubleAnimation(xStart, xEnd,
                                                             new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    verticalMovement = new DoubleAnimation(yStart, yEnd,
                                                           new Duration(new TimeSpan(0, 0, 0, timeToMove)));
                    Storyboard.SetTarget(horizontalMovement, ImageToMove);
                    Storyboard.SetTarget(verticalMovement, ImageToMove);
                    Storyboard.SetTargetProperty(horizontalMovement, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetProperty(verticalMovement, new PropertyPath("(Canvas.Top)"));
                    ImageMovement.Children.Add(horizontalMovement);
                    ImageMovement.Children.Add(verticalMovement);
                    break;

                case MovementType.Circular:
                    FaceDirection(true);
                    xStart = 0;
                    yStart = (GameWindow.ActualHeight - ImageToMove.Height) / 2;
                    Canvas.SetTop(ImageToMove, yStart);
                    Canvas.SetLeft(ImageToMove, xStart);

                    System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
                    customCulture.NumberFormat.NumberDecimalSeparator    = ".";
                    System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
                    var xMid = (GameWindow.ActualWidth - ImageToMove.Width) / 2;
                    var yMid = (GameWindow.ActualHeight - ImageToMove.Height) / 2;

                    var path          = $"M 0,{yStart} A {xMid},{yMid} 0 1 1 0,{yStart + 0.0001}";
                    var pathUpperHalf = new PathGeometry();
                    pathUpperHalf.Figures = PathFigureCollection.Parse(path);

                    var circularMovement1 = new DoubleAnimationUsingPath();
                    circularMovement1.PathGeometry = pathUpperHalf;
                    circularMovement1.Duration     = new Duration(new TimeSpan(0, 0, 0, timeToMove));
                    circularMovement1.Source       = PathAnimationSource.X;

                    var circularMovement2 = new DoubleAnimationUsingPath();
                    circularMovement2.PathGeometry = pathUpperHalf;
                    circularMovement2.Duration     = new Duration(new TimeSpan(0, 0, 0, timeToMove));
                    circularMovement2.Source       = PathAnimationSource.Y;

                    Storyboard.SetTarget(circularMovement1, ImageToMove);
                    Storyboard.SetTargetProperty(circularMovement1, new PropertyPath("(Canvas.Left)"));

                    Storyboard.SetTarget(circularMovement2, ImageToMove);
                    Storyboard.SetTargetProperty(circularMovement2, new PropertyPath("(Canvas.Top)"));

                    ImageMovement.Children.Add(circularMovement1);
                    ImageMovement.Children.Add(circularMovement2);
                    break;

                default:
                    break;
                }
                Controller.Pause();
                ImageToMove.Visibility = Visibility.Visible;
                var t = int.Parse(Application.Current.Properties["InteractionTime"].ToString());
                InteractionTimer.Interval = t * 1000;
                SoundTimer.Interval       = 5000;
                InteractionTimer.Start();
                SoundNeeded = false;
            }
            else
            {
                Application.Current.Properties["CurrentMovement"] =
                    Int32.Parse(Application.Current.Properties["CurrentMovement"].ToString()) + 1;
                AnimatingControl_Loaded();
            }
        }
コード例 #14
0
 private void gif_Cargado(object sender, RoutedEventArgs e)
 {
     controladorGif          = ImageBehavior.GetAnimationController(image_Dado);
     button_Tirar.Visibility = Visibility.Visible;
 }
コード例 #15
0
 private void OnAnimationLoaded(object sender, RoutedEventArgs e)
 {
     this.imageAnimationController = ImageBehavior.GetAnimationController(this.HearththrobAnimation);
     this.imageAnimationController?.Pause();
 }
コード例 #16
0
ファイル: CardUnit.cs プロジェクト: lvovandrey/VGAME_New
        private CardUnit(Scene scene, Card card)
        {
            Card  = card;
            Scene = scene;

            HaveBody        B;
            HaveBox         haveBox;
            VideoInCard     videoInCard;
            CheckedSymbol   ChS;
            DragAndDrop     DaD;
            Moveable        M;
            HiderShower     ShowComp;
            CardShower      cardShower;
            OLDInGameStruct InGS;
            UState          uState;
            Hit             hit;

            B           = new HaveBody("HaveBody", this, new CardUnitElement());
            videoInCard = new VideoInCard("VideoInCard", this, ((CardUnitElement)B.Body).ContentGrid);

            if (System.IO.File.Exists(card.ImageAddress) || Miscellanea.UrlExists(card.ImageAddress))
            {
                if (Path.GetExtension(card.ImageAddress) == ".gif")
                {
                    var image = new BitmapImage();
                    image.BeginInit();
                    image.UriSource = new Uri(card.ImageAddress);
                    image.EndInit();
                    ImageBehavior.SetAnimatedSource(((CardUnitElement)B.Body).Img, image);
                    GifController = ImageBehavior.GetAnimationController(((CardUnitElement)B.Body).Img);
                }
                else if (Path.GetExtension(card.ImageAddress) == ".wmv" || Path.GetExtension(Card.ImageAddress) == ".avi")
                {
                    ((CardUnitElement)B.Body).Img.Visibility = System.Windows.Visibility.Collapsed;
                    videoInCard.Run(card.ImageAddress);
                }
                else
                {
                    ((CardUnitElement)B.Body).Img.Source = PictHelper.GetBitmapImage(new Uri(card.ImageAddress));
                }
            }
            else
            {
                if (System.IO.File.Exists(Sets.Settings.GetInstance().DefaultImage))
                {
                    ((CardUnitElement)B.Body).Img.Source =
                        PictHelper.GetBitmapImage(new Uri(Sets.Settings.GetInstance().DefaultImage));
                }
                else
                {
                    MessageBox.Show("Файл изображения не найден:  " + card.ImageAddress);
                }
            }

            ShowComp      = new HiderShower("HiderShower", this);
            cardShower    = new CardShower("CardShower", this);
            InGS          = new OLDInGameStruct("InGameStruct", this, Scene);
            hit           = new Hit("Hit", this);
            uState        = new UState("UState", this);
            uState.newOld = NewOld.New;
            ShowComp.Hide();

            B.Body.PreviewMouseLeftButtonDown += Body_PreviewMouseLeftButtonDown;
        }
コード例 #17
0
        public ShowGifImage()
        {
            InitializeComponent();
            Image img = new Image();

            BitmapImage bitmapImage = new BitmapImage(new Uri("pack://application:,,,/Pr60_TestFunction;component/F02_ShowImage/GifImg/theme_2_animation.gif"));
            Image       image       = new Image();

            image.Margin = new Thickness(10);
            ImageBehavior.SetAnimatedSource(image, bitmapImage);

            Slider slider = new Slider();

            slider.Maximum       = 3;
            slider.Minimum       = 1;
            slider.Value         = 2;
            slider.Orientation   = Orientation.Horizontal;
            slider.Width         = 300;
            slider.SmallChange   = 1;
            slider.TickFrequency = 1;

            /******* Control Layout ********/
            mainGrid.Children.Add(image);
            Grid.SetRow(image, 0);
            Grid.SetColumn(image, 1);

            StackPanel sp = new StackPanel
            {
                Orientation = Orientation.Vertical,
                Background  = Brushes.Beige
            };

            TextBlock txt = new TextBlock();

            txt.FontSize            = 20;
            txt.Margin              = new Thickness(6);
            txt.HorizontalAlignment = HorizontalAlignment.Center;
            txt.Text = "showSpeed";


            mainGrid.Children.Add(sp);
            Grid.SetRow(sp, 1);
            Grid.SetColumn(sp, 1);
            sp.Children.Add(slider);
            sp.Children.Add(txt);

            Binding bind = new Binding();

            bind.Source = slider;
            bind.Path   = new PropertyPath(Slider.ValueProperty);
            bind.Mode   = BindingMode.Default;
            txt.SetBinding(TextBlock.TextProperty, bind);

            // 将Gif动画的速度值绑定到Slider上
            Binding bindspeed = new Binding();

            bindspeed.Source = slider;
            bindspeed.Path   = new PropertyPath(Slider.ValueProperty);
            image.SetBinding(ImageBehavior.AnimationSpeedRatioProperty, bindspeed);


            //Grid0/3
            BitmapImage bitmapImage03 = new BitmapImage(new Uri("pack://application:,,,/Pr60_TestFunction;component/F02_ShowImage/GifImg/theme_2_animation.gif"));

            image.Margin = new Thickness(10);
            ImageBehavior.SetAnimatedSource(image03, bitmapImage03);
            gif.Children.Add(image03);


            // Get the speed ratio of gif.
            ImageBehavior.AddAnimationLoadedHandler(ImgS3, new RoutedEventHandler((s2, e2) =>
            {
                gifSpeedController = ImageBehavior.GetAnimationController(ImgS3);
            }));
        }
コード例 #18
0
 /// <summary>
 /// Loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ImageLoadingGif_AnimationLoaded(object sender, RoutedEventArgs e)
 {
     imageController = ImageBehavior.GetAnimationController(imageLoadingGif);
 }
コード例 #19
0
 /// <summary>
 /// Loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ImageLoadingGif_AnimationLoaded(object sender, RoutedEventArgs e)
 {
     imageController = ImageBehavior.GetAnimationController(imageLoadingGif);
     imageController.Pause(); // pause by default
 }
コード例 #20
0
 public ImageAnimationControllerWrapper(ImageAnimationController controller, Dispatcher dispatcher)
 {
     mController = controller;
     mDispatcher = dispatcher;
     mController.CurrentFrameChanged += _HandleCurrentFrameChanged;
 }