Beispiel #1
0
        /// <summary>
        /// Грузит в главный Grid окна владельца Owner фон из картинки
        /// </summary>
        /// <param name="BackgroundFilename">Путь к файлу картинки на диске</param>
        public static void LoadBackGround(string BackgroundFilename)
        {
            ImageBrush im = new ImageBrush();

            im.ImageSource            = PictHelper.GetBitmapImage(new Uri(BackgroundFilename));
            Owner.BaseGrid.Background = im;
        }
Beispiel #2
0
 void OnStateChange()
 {
     if (IsPlaying && !IsPaused)
     {
         PlayBtn.Source = PictHelper.GetBitmapImage(new Uri("pack://application:,,,/Images/BtnStop.png"));
     }
     else
     {
         PlayBtn.Source = PictHelper.GetBitmapImage(new Uri("pack://application:,,,/Images/BtnPlay.png"));
     }
 }
Beispiel #3
0
 public PrevMenuItem(string ImgFilename, string ImgType) : this()
 {
     if (ImgFilename == "" || ImgFilename == null)
     {
         return;
     }
     if (ImgType == "youtube")
     {
         Img.Source = PictHelper.GetBitmapImage(new Uri(@ImgFilename));
     }
     else
     {
         LoadImage(ImgFilename);
     }
 }
Beispiel #4
0
        public void UnloadImage()
        {
            if (Path.GetExtension(Card.ImageAddress) == ".gif")
            {
                var image = new BitmapImage();
                image.BeginInit();
                image.UriSource = new Uri("pack://application:,,,/Images/simpleGif.gif");
                image.EndInit();
                ImageBehavior.SetAnimatedSource(((CardUnitElement)GetComponent <HaveBody>().Body).Img, image);
            }
            else if (Path.GetExtension(Card.ImageAddress) == ".wmv" || Path.GetExtension(Card.ImageAddress) == ".avi")
            {
                GetComponent <VideoInCard>().Delete();
            }
            else
            {
                ((CardUnitElement)GetComponent <HaveBody>().Body).Img.Source = PictHelper.GetBitmapImage(new Uri("pack://application:,,,/Images/simpleGif.gif"));
            }

            GifController?.Dispose();
            GC.Collect();
        }
Beispiel #5
0
        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;
        }