Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        public async void RefreshYoutubeLink()
        {
            if (this.VideoInfo.Type != VideoType.youtube)
            {
                return;
            }

            YoutubeVidInfo vidInfo = new YoutubeVidInfo(VideoInfo.Address);
            await vidInfo.NEWLIBRARY_GetVideoAsync();

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

            YoutubePreview = vidInfo.ImageUrl;

            this.VideoInfo.Source = new Uri(vidInfo.DirectURL);
            OnPropertyChanged("VideoInfo");
        }
Ejemplo n.º 3
0
        private async void RefreshYoutubeVideoInfo(VideoInfoVM videoInfoVM)
        {
            if (videoInfoVM == null)
            {
                return;
            }
            if (videoInfoVM.Title == null)
            {
                return;
            }
            if (videoInfoVM.Type != Model.VideoType.youtube)
            {
                return;
            }

            YoutubeVidInfo vidInfo = new YoutubeVidInfo(videoInfoVM.Title);
            await vidInfo.NEWLIBRARY_GetVideoAsync();

            if (vidInfo.DirectURL == "")
            {
                return;
            }

            videoInfoVM.Source     = new Uri(vidInfo.DirectURL);
            videoInfoVM.Duration   = vidInfo.Duration;
            videoInfoVM.Resolution = vidInfo.Resolution;

            videoInfoVM.PreviewVM.Source = new Uri(vidInfo.ImageUrl);
            videoInfoVM.PreviewVM.Size   = new System.Drawing.Size(480, 360);

            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.Type = Model.PreviewType.youtube;
            ObservableCollection <Uri> uris = new ObservableCollection <Uri>();

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

            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.MultiplePrevSources = uris;
        }
Ejemplo n.º 4
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            TabItemEditor.Focus();
            if (ViewModel.SelectedLevelVM == null)
            {
                return;
            }

            YoutubeVidInfo vidInfo = new YoutubeVidInfo(TextURL.Text);
            await vidInfo.NEWLIBRARY_GetVideoAsync();

            if (vidInfo.DirectURL == "")
            {
                return;
            }

            ViewModel.SelectedLevelVM.VideoInfoVM.Source           = new Uri(vidInfo.DirectURL);
            ViewModel.SelectedLevelVM.VideoInfoVM.Address          = TextURL.Text;
            ViewModel.SelectedLevelVM.VideoInfoVM.Description      = vidInfo.Title;
            ViewModel.SelectedLevelVM.VideoInfoVM.Duration         = vidInfo.Duration;
            ViewModel.SelectedLevelVM.VideoInfoVM.Resolution       = vidInfo.Resolution;
            ViewModel.SelectedLevelVM.VideoInfoVM.Title            = vidInfo.Title;
            ViewModel.SelectedLevelVM.VideoInfoVM.Type             = Model.VideoType.youtube;
            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.Source = new Uri(vidInfo.ImageUrl);
            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.Size   = new System.Drawing.Size(480, 360);

            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.Type = Model.PreviewType.youtube;
            ObservableCollection <Uri> uris = new ObservableCollection <Uri>();

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

            ViewModel.SelectedLevelVM.VideoInfoVM.PreviewVM.MultiplePrevSources = uris;
            //     ViewModel.SelectedLevelVM.SegregateScenes();
        }