Exemplo n.º 1
0
        private void getSettings()
        {
            launchAtLogin.IsChecked = MainWindow.launchAtLogin;
            try
            {
                if (MainWindow.isVideo)
                {
                    preview.Source  = new Uri(MainWindow.wallpaperSource);
                    volSlider.Value = MainWindow.volume;
                    foreach (Background bg in mw.backgrounds)
                    {
                        if (bg.display == MainWindow.primaryDisplay)
                        {
                            preview.Position = bg.wallpaperContent.Position;
                            break;
                        }
                    }
                }
                else
                {
                    volSlider.IsEnabled = false;
                    volText.IsEnabled   = false;
                    var img = new BitmapImage();
                    img.BeginInit();
                    img.UriSource = new Uri(MainWindow.wallpaperSource);
                    img.EndInit();
                    ImageBehavior.SetAnimatedSource(imagePreview, img);
                }
            }
            catch (Exception ex) { LogWriter.CreateLog(ex); MessageBox.Show("Failed to set media source."); mw.Close(); }

            skip = false;
        }
        private void MostrarDados(int numDados)
        {
            ColumnDefinition columna;

            for (int i = 0; i < numDados; i++)
            {
                var gifDado = new BitmapImage();
                gifDado.BeginInit();
                gifDado.UriSource = new Uri("/Resources/Tablero/Dado/dado.gif", UriKind.Relative);
                gifDado.EndInit();
                columna       = new ColumnDefinition();
                columna.Width = new GridLength(110);
                grid_Dados.ColumnDefinitions.Add(columna);
                if (i == 0)
                {
                    ImageBehavior.SetAnimatedSource(image_Dado, gifDado);
                    Grid.SetColumn(image_Dado, i);
                }
                else
                {
                    ImageBehavior.SetAnimatedSource(image_Dado2, gifDado);
                    Grid.SetColumn(image_Dado, i);
                }
            }
        }
        protected override void OnExit(object sender, RoutedEventArgs e)
        {
            base.OnExit(sender, e);

            foreach (var button in lstImages.Children)
            {
                ImagePreviewButton imageButton = button as ImagePreviewButton;

                if (imageButton == null)
                {
                    continue;
                }

                ImageBehavior.SetAnimatedSource(imageButton.img, null);
            }

            lstImages.Children.Clear();

            UpdateLayout();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            if (!IsOnExitActive)
            {
                e.Handled = true;
                return;
            }
        }
Exemplo n.º 4
0
        public void FillBackgroundImage(IMG imageuri)
        {
            Image img = new Image();

            img.Margin              = new Thickness(0, 0, 0, 0);
            img.Width               = 750;
            img.Height              = 750;
            img.VerticalAlignment   = VerticalAlignment.Top;
            img.HorizontalAlignment = HorizontalAlignment.Center;

            var image = new BitmapImage();

            image.BeginInit();

            if (File.Exists(imageuri.Adress))
            {
                image.UriSource = new Uri(imageuri.Adress);
            }
            else
            {
                image.UriSource = new Uri(GetFilePath(4 + ".gif"));
            }
            image.EndInit();

            //ImageBehavior.SetRepeatBehavior(image,);
            ImageBehavior.SetAnimatedSource(img, image);
            ImageHere.Children.Clear();
            ImageHere.Children.Add(img);
        }
Exemplo n.º 5
0
 private void dispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (showAds)
     {
         ImageBehavior.SetAnimatedSource(banner, ResourceHelper.LoadBitmapFromResource("img/ads/" + ads[rnd.Next(ads.Count)] + ".gif"));
     }
 }
        protected void si_S2I1ImagePicked(object sender, EventArgs e)
        {
            OSAEImageManager imgMgr = new OSAEImageManager();

            State2Img1 = imgMgr.GetImage((int)sender);
            MemoryStream ms1         = new MemoryStream(State1Img1.Data);
            BitmapImage  bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.StreamSource = ms1;
            bitmapImage.EndInit();
            ImageBehavior.SetAnimatedSource(imgState2Img1, bitmapImage);
            //imgState2Img1.Source = LoadImage(State2Img1.Data);
            imgState2Img1.ToolTip = "Width:" + imgState2Img1.Width + " Height:" + imgState2Img1.Height;
            Validate_Initial_Coordinates();
            lblState2X.IsEnabled = true;
            lblState2Y.IsEnabled = true;
            txtState2X.IsEnabled = true;
            txtState2Y.IsEnabled = true;
            lblZOrder.IsEnabled  = true;
            txtZOrder.IsEnabled  = true;
            if (State2Img1.Type != "gif")
            {
                btnLoadS2I2.IsEnabled   = true;
                imgState2Img2.IsEnabled = true;
            }
        }
Exemplo n.º 7
0
        public Window1(MainWindow padre)
        {
            string path = Directory.GetCurrentDirectory();

            mediaPlayer.Open(new Uri(path + "/Audios/Marvel Opening Theme.m4a"));
            mediaPlayer.Play();

            InitializeComponent();
            mediaPlayer.Volume = 1;


            this.padre = padre;
            eventoBienvenida();

            var image = new BitmapImage();

            image.BeginInit();
            image.UriSource = new Uri(path + "/Fotos/gif capi.gif");
            image.EndInit();
            ImageBehavior.SetAnimatedSource(gifCapi, image);

            var image2 = new BitmapImage();

            image2.BeginInit();
            image2.UriSource = new Uri(path + "/Fotos/capi bienvenida.gif");
            image2.EndInit();
            ImageBehavior.SetAnimatedSource(capiCentrado, image2);
        }
Exemplo n.º 8
0
        private Image Emotion(IEmotic img, string s)
        {
            Image       image = new Image();
            BitmapImage bm1   = new BitmapImage();


            bm1.BeginInit();
            bm1.UriSource   = new Uri(img.Url);
            bm1.CacheOption = BitmapCacheOption.OnLoad;
            bm1.EndInit();

            image.BeginInit();
            image.Source           = bm1;
            image.Height           = img.Height ?? 0;
            image.Width            = img.Width ?? 0;
            image.Stretch          = Stretch.UniformToFill;
            image.StretchDirection = StretchDirection.Both;
            image.Tag = s;
            if (img.ImageType.Equals("gif"))
            {
                ImageBehavior.SetAnimatedSource(image, bm1);
            }
            image.MouseEnter += Image_MouseEnter;
            image.MouseLeave += Image_MouseLeave;
            image.EndInit();

            return(image);
        }
        private void UpdatePreview()
        {
            Dispatcher.Invoke(() => {
                TimeSpan duration = new TimeSpan(0, 0, 1);

                // Fade controls out
                Fade(new DoubleAnimation {
                    From     = 1.0, To = 0.0,
                    Duration = new Duration(duration)
                }, initialStage.Name);

                // Fade GIF in
                Fade(new DoubleAnimation {
                    From     = 0.0, To = 1.0,
                    Duration = new Duration(duration)
                }, finalStage.Name);

                // Animate output GIF
                var image = new BitmapImage();
                image.BeginInit();
                image.UriSource = new Uri(outputFullPath);
                image.EndInit();
                ImageBehavior.SetAnimatedSource(gifPreview, image);
            });
        }
Exemplo n.º 10
0
 private void UpdateEnemy()
 {
     this.DelcareEnemyPokemon();
     ImageBehavior.SetAnimatedSource(this.ImgEnemyPokemon, GameSettings.EnemyPokemon.FrontPath);
     this.ImgEnemyPokemon_OnAnimationLoaded(this.ImgEnemyPokemon, null);
     this.EnemyHp.SmoothValue = GameSettings.MaxHealth;
 }
Exemplo n.º 11
0
 private void ShowPokemon()
 {
     this.PlayerHp.SmoothValue = 1000;
     this.EnemyHp.SmoothValue  = 1000;
     ImageBehavior.SetAnimatedSource(this.ImgPlayerPokemon, GameSettings.PlayerPokemon.BackPath);
     ImageBehavior.SetAnimatedSource(this.ImgEnemyPokemon, GameSettings.EnemyPokemon.FrontPath);
 }
Exemplo n.º 12
0
        public Task UpdateComments(bool resetScroll = true)
        {
            foreach (var comment in lstComments.Children)
            {
                UserComment userComment = comment as UserComment;

                if (userComment == null)
                {
                    continue;
                }

                ImageBehavior.SetAnimatedSource(userComment.AvatarImage, null);
            }

            lstComments.Children.Clear();

            Offset = 0;
            btnLoadMore.Visibility = Visibility.Collapsed;

            UpdateLayout();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            if (resetScroll)
            {
                PostOverlayPage page = this.TryFindParent <PostOverlayPage>();

                page?.svPost?.ScrollToVerticalOffset(0.0);
            }

            return(LoadMoreComments());
        }
Exemplo n.º 13
0
        public static void StartLoading(double windowHeight, double windowWidth, Grid loadingGrid, String message, int loadingImageHeight = 150, int loadingImageWidth = 150)
        {
            // Set loading image
            loadingGrid.Height     = windowHeight;
            loadingGrid.Width      = windowWidth;
            loadingGrid.Background = System.Windows.Media.Brushes.White;
            StackPanel sp = new StackPanel()
            {
                VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center
            };

            // Load Image
            System.Windows.Controls.Image load = new System.Windows.Controls.Image()
            {
                Width  = loadingImageWidth,
                Height = loadingImageHeight,
                Margin = new System.Windows.Thickness(-10)
            };
            ImageBehavior.SetAnimatedSource(load, PathUtilities.GetImageSource("loading.gif"));
            sp.Children.Add(load);

            // Label
            Label l = new Label()
            {
                Content             = message,
                VerticalAlignment   = System.Windows.VerticalAlignment.Center,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center
            };

            sp.Children.Add(l);

            loadingGrid.Children.Add(sp);
        }
Exemplo n.º 14
0
        private void missionInfoOn(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;

            foreach (Mission m in missions)
            {
                if (m.id == int.Parse(b.Tag.ToString()))
                {
                    clickedmission = m;
                }
            }
            mission_info.Visibility = Visibility.Visible;
            infoname.Text           = clickedmission.name;
            //img
            var bitmap = new BitmapImage();

            bitmap.BeginInit();
            bitmap.UriSource = new Uri(@"../../img/" + clickedmission.name.Substring(0, clickedmission.name.Length - 5) + "_stand.gif", UriKind.Relative);
            bitmap.EndInit();
            ImageBehavior.SetAnimatedSource(mobimg, bitmap);
            ImageBehavior.SetRepeatBehavior(mobimg, RepeatBehavior.Forever);
            //
            infodescription.Text = clickedmission.description;
            enterBattle.Click   += EnterBattle_Click;
        }
        public ConnectedWifi()
        {
            this.InitializeComponent();
            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.UriSource = new Uri(Theming.GetThemedImage("Background\\stats-wifi-ghostie.gif"));
            bitmapImage.EndInit();
            ImageBehavior.SetAnimatedSource(this.SurfingAnimated, bitmapImage);
            this._wiFiDetector.add_OnNewWiFiDetected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnNewWiFiDetected));
            this._wiFiDetector.add_OnSignalStrengthChanged(new WiFiDetector.SignalStrengthChanged(this._wiFiDetector_OnSignalStrengthChanged));
            this._wiFiDetector.add_OnWifiDisconnected(new WiFiDetector.NewWiFiDetected(this._wiFiDetector_OnWifiDisconnected));
            this._wiFiDetector.set_Enabled(true);
            this.< IconPathString > k__BackingField = Theming.GetThemedImage("Icons\\ProfileTabs\\ico-wifi-color.png");
            try
            {
                this.Surfing.Source = new BitmapImage(new Uri(Theming.GetThemedImage("Background\\stats-surfen-ghostie.png")));
            }
            catch (FileNotFoundException ex)
            {
                DebugLogHelper.Instance.Info(string.Format("{0}.{1} {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message));
            }
            catch (ArgumentNullException ex2)
            {
                DebugLogHelper.Instance.Info(string.Format("{0}.{1} {2}", base.GetType().Name, MethodBase.GetCurrentMethod().Name, ex2.Message));
            }
        }
Exemplo n.º 16
0
        public SplashScreen()
        {
            Random random = new Random();

            string[] gifs = new string[]
            {
                "akagi-cooks",
                "akashi",
                "amagi",
                "enter",
                "excited",
                "FDG",
                "gacha",
                "gaming",
                "hehe",
                "here-comes-akagi",
                "luffy",
                "mad-akagi",
                "numba-wan",
                "open-up",
                "panic",
                "portland",
                "scared",
                "uni"
            };

            InitializeComponent();

            BitmapImage gif =
                new BitmapImage(
                    new Uri($"pack://application:,,,/Resources/SplashScreenGifs/{gifs[random.Next(gifs.Length - 1)]}.gif"));

            ImageBehavior.SetAnimatedSource(img, gif);
        }
Exemplo n.º 17
0
        public ROFLCopter(List <Grid> targetGrids)
        {
            _copter         = new Image();
            _copter.Stretch = Stretch.None;

            _targetGrids = targetGrids;

            var gif = new BitmapImage();

            gif.BeginInit();
            gif.UriSource = new Uri("..\\images\\roflcropped.gif", UriKind.Relative);
            gif.EndInit();

            ImageBehavior.SetAnimatedSource(_copter, gif);

            _translatePitch = new RotateTransform(10);
            _translateXY    = new TranslateTransform();

            var group = new TransformGroup();

            _copter.RenderTransform = group;
            _copter.Width           = 300;
            _copter.Height          = 300;

            group.Children.Add(_translatePitch);
            group.Children.Add(_translateXY);

            var easingY = new SineEase
            {
                EasingMode = EasingMode.EaseInOut
            };

            var easingPitch = new QuadraticEase
            {
                EasingMode = EasingMode.EaseOut
            };

            _animatePitch = new DoubleAnimation(0, 10, new Duration(new TimeSpan(0, 0, 5)))
            {
                EasingFunction = easingPitch,
                AutoReverse    = true
            };

            _animateY = new DoubleAnimation()
            {
                EasingFunction = easingY,
                AutoReverse    = true
            };

            _animateX            = new DoubleAnimation();
            _animateX.Completed += OnAnimationCompleted;

            _copter.Loaded += (s, a) =>
            {
                Play();
            };

            SetActiveGrid();
            _activeGrid.Children.Add(_copter);
        }
Exemplo n.º 18
0
 /// <summary>
 /// Sets up the strings for the various gifs that combine to form the avatar.
 /// </summary>
 public void refreshAnimation()
 {
     if (classId < 5)
     {
         try
         {
             for (int i = 0; i < partcodes.Count; i++)
             {
                 try
                 {
                     ImageBehavior.SetAnimatedSource(testImage, ResourceHelper.LoadBitmapFromResource("char/"
                                                                                                      + d2class + "/" + partcodes[i] + "/" + d2class + partcodes[i] + partpaths[i] + mode + stance + ".gif"));
                     //We do this testImage thing first to make sure the image can be loaded.
                     partstrings[i] = "/d2c;component\\char\\" + d2class + "\\" + partcodes[i] + "\\" + d2class
                                      + partcodes[i] + partpaths[i] + mode + stance + ".gif";
                 }
                 catch (System.IO.IOException e)
                 {
                     partstrings[i] = "/d2c;component\\char\\" + d2class + "\\" + partcodes[i] + "\\" + d2class
                                      + partcodes[i] + partpaths[i] + mode + backupstance[classId] + ".gif";
                 }
             }
         }
         catch (NullReferenceException e)
         {
         }
     }
 }
Exemplo n.º 19
0
        public Overlay(Uri uriImagePath, Uri sNetworkUrl = null)
        {
            InitializeComponent();

            if (sNetworkUrl != null)
            {
                this.uriImagePath = sNetworkUrl;
            }
            else
            {
                this.uriImagePath = uriImagePath;
            }
            try
            {
                bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.UriSource   = uriImagePath;
                bitmapImage.CacheOption = BitmapCacheOption.OnDemand;
                bitmapImage.EndInit();

                ImageBehavior.SetAnimatedSource(image, bitmapImage);

                Width  = bitmapImage.Width;
                Height = bitmapImage.Height;
            }
            catch
            {
                throw new Exception("Error loading Image!");
            }
        }
Exemplo n.º 20
0
        void ProcessObstacles()
        {
            if (tick % ((ulong)(50 / speedArr[speedArrIndex])) == 0)
            {
                if (obstacles[0] != null)
                {
                    obstacles[0].Destroy();
                    score += (ulong)(speedArr[speedArrIndex]);
                }
                obstacles.RemoveAt(0);
                AddRandomObstacle();
            }

            if (obstacles[2] != null)
            {
                if (playerState != obstacles[2].stateToAvoid)
                {
                    gameCanvas.Children.Remove(playerImage);
                    playerImage        = new Image();
                    playerImage.Width  = 150;
                    playerImage.Height = 150;
                    ImageBehavior.SetAnimatedSource(playerImage, new BitmapImage(new Uri(@"Resources\img\playerFall.gif", UriKind.Relative)));
                    ImageBehavior.SetRepeatBehavior(playerImage, new System.Windows.Media.Animation.RepeatBehavior(1));
                    gameCanvas.Children.Add(playerImage);
                    Canvas.SetLeft(playerImage, 0);
                    Canvas.SetTop(playerImage, 50);
                    Canvas.SetZIndex(playerImage, 5);

                    Sound.Fall();
                    timer.Stop();
                    Timer gameoverTimer = new Timer()
                    {
                        AutoReset = false,
                        Interval  = 1100,
                        Enabled   = false,
                    };
                    gameoverTimer.Elapsed += (a, b) => {
                        System.Windows.Application.Current.Dispatcher.Invoke((Action) delegate {
                            WindowManager.ReopenWindow(this, MenuWindow.GameOverWindow);
                        });
                    };
                    gameoverTimer.Start();
                }
                else if (obstacles[2].stateToAvoid == PlayerState.Slash)
                {
                    obstacles[2].Destroy();
                    obstacles[2] = null;
                    score       += (ulong)(speedArr[speedArrIndex]);
                }
            }
            if (obstacles[3] != null)
            {
                if (obstacles[3].stateToAvoid == PlayerState.Slash && playerState == PlayerState.Slash)
                {
                    obstacles[3].Destroy();
                    obstacles[3] = null;
                    score       += (ulong)(speedArr[speedArrIndex]);
                }
            }
        }
Exemplo n.º 21
0
        public void LoadMap()
        {
            #region #region LoadFloat
            var converter = new ImageSourceConverter();
            var source    = (ImageSource)converter.ConvertFromString(@"D:\repos\Die_And_KILL\Die_And_Kill\Resources\Block.jpg");
            blocks = new Image[core.map.weight, core.map.height];
            for (int x = 0; x < core.map.weight; x++)
            {
                for (int y = 0; y < core.map.height; y++)
                {
                    if (core.map.grid[x, y] == "1")
                    {
                        var img = new Image()
                        {
                            Source = source,
                            Height = 30,
                            Width  = 30,
                        };

                        MyCanvas.Children.Add(img);
                        Canvas.SetLeft(img, x * 30);
                        Canvas.SetTop(img, y * 30);
                        blocks[x, y] = img;
                    }
                }
            }
            var transform = 42.0 / core.map.weight;
            MyCanvas.LayoutTransform = new ScaleTransform(transform, transform);
            #endregion

            #region Load Worms
            var i = 0;
            foreach (Worm worm in core.worms)
            {
                worms.Add(new UserControlWorms(worm));

                var image = new BitmapImage();
                image.BeginInit();
                image.UriSource = new Uri(@"D:\repos\Die_And_KILL\Die_And_Kill\Resources\9.gif");
                image.EndInit();
                ImageBehavior.SetAnimatedSource(worms[i].icon, image);

                Canvas.SetLeft(worms[i], worm.position.x * 30);
                Canvas.SetTop(worms[i], worm.position.y * 30 - 36);
                worms[i].CanvasXPos = worm.position.x * 30;
                worms[i].CanvasYPos = worm.position.y * 30 - 36;
                MyCanvas.Children.Add(worms[i]);

                i++;
            }
            #endregion

            #region Turn queue
            foreach (UserControlWorms w in worms)
            {
                turns.Enqueue(w);
            }

            #endregion
        }
        private void playGif(Image image)
        {
            var control = ImageBehavior.GetAnimationController(image);

            control.GotoFrame(0);
            control.Play();
        }
Exemplo n.º 23
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();
            }
        }
        private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
        {
            Border border = (Border)((StackPanel)sender).Parent;
            var    image  = ((StackPanel)sender).Children.OfType <Image>().FirstOrDefault();
            NameToResourceConverter conv = new NameToResourceConverter();

            stopGif(image);
            var img = new BitmapImage();

            img.BeginInit();
            img.UriSource = (Uri)conv.Convert(((StackPanel)sender).Name, null, "jpg", null);
            img.EndInit();
            ImageBehavior.SetAnimatedSource(image, img);

            if (!isStackPanelSelected(border))
            {
                border.BorderBrush = Brushes.White;
            }

            int classifersCount = Classifiers.Count;

            if (classifersCount == 6)
            {
                txtBlkInfo.Text = String.Format(DONEMSG, classifersCount);
            }
            else
            {
                txtBlkInfo.Text = String.Format(ACTIVEMSG, classifersCount, 6 - classifersCount);
            }
        }
Exemplo n.º 25
0
        public AnimatedGifWindow()
        {
            var img = new Image();
            var src = default(BitmapImage);

            var source = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "background.gif");

            if (File.Exists(source))
            {
                src = new BitmapImage();
                src.BeginInit();
                src.StreamSource = File.OpenRead(source);
                src.EndInit();

                ImageBehavior.SetAnimatedSource(img, src);
                this.Content = img;
                this.Width   = src.Width;
                this.Height  = src.Height;
            }

            this.AllowsTransparency    = true;
            this.WindowStyle           = WindowStyle.None;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.ShowInTaskbar         = true;
            this.Background            = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
        }
Exemplo n.º 26
0
        public MainWindow()
        {
            InitializeComponent();
            _context     = new MainViewModel();
            DataContext  = _context;
            SizeChanged += MainWindow_Resize;

            _keyboardHook = new KeyboardHook();
            _keyboardHook.SetOnKeyDownEvent(Win32_Keydown);
            _keyboardHook.SetHook();

            var brush = new ImageBrush
            {
                ImageSource = new BitmapImage(new Uri("pack://application:,,,/Image/20141008063846.jpg"))
            };

            MyCircle.Background = brush;

            var gif = new BitmapImage(new Uri("pack://application:,,,/Image/IMG_7189.gif"));

            ImageBehavior.SetAnimatedSource(MyImage, gif);
            ImageBehavior.SetRepeatBehavior(MyImage, RepeatBehavior.Forever);

            WeakReferenceMessenger.Default.Register <Message>(this, OnReceive);
        }
Exemplo n.º 27
0
        private void Punch_Button(object sender, RoutedEventArgs e)
        {
            int rnddmg = rnd.Next(Village.naruto.mindamage, Village.naruto.taijutsu + Village.naruto.maxdamage + playercombatdamage);

            PreBattleground.currentEnemy.health -= rnddmg;
            PreBattleground.currentEnemy.combat += rnddmg / 2;
            enemycombatdamage        += rnddmg / 2;
            plusminusenemy.Foreground = Brushes.Red;
            plusminusenemy.Content    = (-rnddmg).ToString();
            plusminusenemy.Visibility = Visibility.Visible;
            Fightbuttons.Visibility   = Visibility.Hidden;
            if (Village.naruto.combat == Village.naruto.maxcombat)
            {
                Village.naruto.combat = 0;
                playercombatdamage    = 0;
                updateStats();
            }
            Canvas.SetLeft(narutoimg, 650);
            updateStats();
            var image = new BitmapImage();

            image.BeginInit();
            image.UriSource = new Uri(@"/img/naruto_punch.gif", UriKind.Relative);
            image.EndInit();
            ImageBehavior.SetAnimatedSource(narutoimg, image);
            ImageBehavior.SetRepeatBehavior(narutoimg, new RepeatBehavior(3));
        }
    private FrameworkElement CreateMediaElement(VisualWrapper visualWrapper)
    {
        BitmapImage bi    = new BitmapImage(new Uri(--YOURIMAGEPATH--));     //Image path goes here
        Image       image = new Image();

        image.Source = bi;
        image.Height = 150;
        image.Width  = 150;
        //image.Margin = new Thickness(-150, -150, -150, -150);

        ImageBehavior.SetAnimatedSource(image, bi);        //See http://wpfanimatedgif.codeplex.com/

        BrushConverter conv = new BrushConverter();
        //SolidColorBrush brush = conv.ConvertFromString("#6C8BBA") as SolidColorBrush;
        Border border = new Border();

        border.Background = Brushes.Transparent;
        //border.BorderBrush = brush;
        //border.BorderThickness = new Thickness(3);
        //border.Margin = new Thickness(-85, -140, 0, 0);

        border.Child = image;

        return(border);
    }
Exemplo n.º 29
0
 private void Btns1_Click(object sender, RoutedEventArgs e)
 {
     ImageBehavior.GetAnimationSpeedRatio(image03);
     ImageBehavior.SetAnimationSpeedRatio(image03, 2);
     ImageBehavior.SetRepeatBehavior(image03, new RepeatBehavior(2));
     ImageBehavior.GetAnimationSpeedRatio(image03);
 }
 private void ShowPendingStatus(string message)
 {
     statusPopup.IsOpen    = true;
     statusText.Content    = "Pending";
     statusMessage.Content = message;
     ImageBehavior.SetAnimatedSource(statusImage, (BitmapImage)FindResource("Pending"));
 }