Exemple #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;
        }
Exemple #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"));
     }
 }
Exemple #3
0
        public async void JoinYoutubeVideoInLevel(string YoutubeAddress)
        {
            MessageBoxResult Res = MessageBoxResult.None;

            if (this.VideoInfo.Address == @"http://localhost/")
            {
                MessageBox.Show("Уровень не пуст, вы уверены что хотите его перезаписать?", "Перезапись уровня", MessageBoxButton.YesNo);
            }
            if (Res == MessageBoxResult.No)
            {
                return;
            }


            YoutubeVidInfo vidInfo = new YoutubeVidInfo(YoutubeAddress);
            await vidInfo.NEWLIBRARY_GetVideoAsync();

            if (vidInfo.DirectURL == "")
            {
                MessageBox.Show("Невозможно получить прямую ссылку на это видео", "Ошибка получения ссылки", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            this.VideoInfo.Source      = new Uri(vidInfo.DirectURL);
            this.VideoInfo.Address     = YoutubeAddress;
            this.VideoInfo.Description = vidInfo.Title;
            this.VideoInfo.Duration    = vidInfo.Duration;
            this.VideoInfo.Resolution  = vidInfo.Resolution;
            this.VideoInfo.Title       = vidInfo.Title;
            this.VideoInfo.Type        = VideoType.youtube;

            OnPropertyChanged("VideoInfo");

            YoutubePreview = vidInfo.ImageUrl;
            this.VideoInfo.Preview.Source = new Uri(vidInfo.ImageUrl);

            this.VideoInfo.Preview.Size = PictHelper.GetPictureSize(this.VideoInfo.Preview.Source);
            //this.VideoInfo.Preview.Size =  new System.Drawing.Size(480, 360);

            this.VideoInfo.Preview.Type = PreviewType.youtube;
            ObservableCollection <Uri> uris = new ObservableCollection <Uri>();

            for (int i = 0; i < 3; i++)
            {
                uris.Add(new Uri(vidInfo.PrevImagesUrl[i]));
            }

            this.VideoInfo.Preview.MultiplePrevSources = uris;
            this.SegregateScenes();
        }
Exemple #4
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);
     }
 }
Exemple #5
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();
        }
Exemple #6
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;
        }