예제 #1
0
        public List <Video> GetByVideoMiolo(VideoMiolo vm, string matricula = null, Aplicacoes IdAplicacao = Aplicacoes.MsProMobile, string VersaoApp = "")
        {
            VideoMioloEntity vme = new VideoMioloEntity();

            vme.setVersaoAplicacao((int)IdAplicacao, VersaoApp);
            vme.setChaveamentoVimeoApostila(new ChaveamentoVimeoMediMiolo());

            var lst = vme.GetByFilters(vm).ToList();

            var lstv = new Videos();

            foreach (var valor in lst)
            {
                if (!lstv.Any(i => i.Url.Equals(valor.HTTPURL)))
                {
                    var video = new Video();
                    video.ID      = Convert.ToInt32(valor.ID);
                    video.VideoId = valor.VideoID;
                    video.Url     = valor.HTTPURL;
                    video.Thumb   = valor.URLThumb;
                    video.Links   = valor.Links;
                    video         = CreateVideoObject(video, matricula);
                    lstv.Add(video);
                }
            }
            return(lstv);
        }
예제 #2
0
        public async Task AddVideo(VideoModel video)
        {
            if (!Videos.Any(v => v.VideoId == video.VideoId))
            {
                // 元データのステータス更新
                video.Status = VideoStatus.New;

                // ビデオ追加
                await AddVideo(video.VideoId);
            }
        }
예제 #3
0
        public bool TryAdd(Video video)
        {
            if (Videos.Any(v => v.ID == video.ID))
            {
                return(false);
            }

            SizeInMb -= video.SizeInMb;

            Videos.Add(video);
            return(true);
        }
        public async Task AddVideo(string id)
        {
            const string url = "http://www.nicovideo.jp/api/deflist/add?item_type=0&item_id={0}&description={1}&token={2}";

            if (!Videos.Any(v => v == id))
            {
                // URLに追加
                var txt = await GetStringAsync(string.Format(url, id, "", await GetToken()));

                // 自身に追加
                Videos.Insert(0, id);
            }
        }
        public async Task DeleteVideo(string id)
        {
            const string url = "http://www.nicovideo.jp/api/deflist/delete?id_list[0][]={0}&token={1}";

            if (Videos.Any(v => v == id))
            {
                // URLに追加
                var txt = await GetStringAsync(string.Format(url, id, await GetToken()));

                // 自身に追加
                Videos.Remove(id);
            }
        }
예제 #6
0
        protected override async Task <bool> SaveAsync()
        {
            if (Videos.Any(v => v.HasDuplicateTag))
            {
                var answer = await messageService.ShowAsync("Save with duplicate tags?", Application.Current.MainWindow.Title, MessageButton.YesNo, MessageImage.Question);

                if (answer == MessageResult.No)
                {
                    return(false);
                }
            }
            try
            {
                var changes = Gallery.GetChanges();
                foreach (var change in changes)
                {
                    switch (change.Value)
                    {
                    case GalleryModel.ChangeType.Edit:
                        await UpdateVideoAsync(change.Key);

                        break;

                    case GalleryModel.ChangeType.Add:
                        await AddVideo(change.Key);

                        break;

                    case GalleryModel.ChangeType.Delete:
                        await DeleteVideo(change.Key);

                        break;

                    case GalleryModel.ChangeType.None:
                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
                await messageService.ShowErrorAsync(ex.Message);

                return(false);
            }
            Gallery.ResetChanges();
            return(await base.SaveAsync());
        }
예제 #7
0
        public async void Init()
        {
            if (Videos?.Any() ?? false)
            {
                return;
            }

            Loading = true;

            var videos = await new PopularVideosQuery().GetVideos();

            Videos = new ObservableCollection <AnimeVideoData>(videos);

            Loading = false;
        }
        private async void VideoProvider_VideoAdded(object sender, Video e)
        {
            if (Videos.Any(x => x.FilePath == e.FilePath))
            {
                return;
            }

            var videoVM = new VideoViewModel(e);

            Videos.Add(videoVM);
            FilteredVideos.Add(videoVM);

            SetCurrentPage();
            videoVM.ThumbailBitmap = await videoVM.GetThumbnailBitmap().ConfigureAwait(false);
        }
예제 #9
0
        /// <summary>
        /// ビデオ情報をマージします。
        /// </summary>
        /// <param name="video">マージするビデオ情報</param>
        public void VideoMerge(VideoModel video)
        {
            if (Videos.Any(v => v.VideoId == video.VideoId))
            {
                var v = Videos.First(temp => temp.VideoId == video.VideoId);

                // 更新要素を再設定
                v.ViewCounter    = video.ViewCounter;
                v.MylistCounter  = video.MylistCounter;
                v.CommentCounter = video.CommentCounter;
                v.LastResBody    = video.LastResBody;
            }
            else
            {
                // 追加
                Videos.Add(video);
            }
        }
예제 #10
0
        private async Task <IEnumerable <Video> > LoadMoreVideos(uint page)
        {
            var response = await _inTouchWrapper.ExecuteRequest(_inTouch.Videos.Get(
                                                                    Album.OwnerId,
                                                                    albumId: (int)Album.Id,
                                                                    count: 50,
                                                                    offset: _offset));

            if (response.IsError)
            {
                throw new Exception(response.Error.ToString());
            }

            if (!Videos.Any() && response.Data.Items.Any())
            {
                SetDefaultMode();
            }

            _offset += 50;
            return(response.Data.Items);
        }
예제 #11
0
        public SessieDetailsViewModel(Sessie sessie)
        {
            this.Naam       = sessie.Naam;
            this.SessieId   = sessie.SessieId;
            this.StartDatum = sessie.StartDatum;
            this.EindDatum  = sessie.EindDatum;
            this.MaxCap     = sessie.MaxCap;
            this.AantalAanwezigeGebruikers    = sessie.AantalAanwezigeGebruikers;
            this.AantalIngeschrevenGebruikers = sessie.AantalIngeschrevenGebruikers;
            this.Lokaal                = sessie.Lokaal;
            this.Beschrijving          = sessie.Beschrijving;
            this.VerantwoordelijkeNaam = sessie.Verantwoordelijke.Voornaam + " " + sessie.Verantwoordelijke.Achternaam;
            this.StaatOpen             = sessie.StaatOpen;
            this._sessie               = sessie;
            this.Media         = sessie.Media;
            this.HeeftMedia    = sessie.Media.Any();
            this.Feedback      = sessie.Feedback;
            this.HeeftFeedback = sessie.Feedback.Any();

            Linken     = Media.Where(m => m.MediaType == MediaType.Link).ToList();
            Videos     = Media.Where(m => (m.MediaType == MediaType.Video || m.MediaType == MediaType.YoutubeVideo)).ToList();
            Documenten = Media.Where(m => (m.MediaType == MediaType.Excel ||
                                           m.MediaType == MediaType.Pdf ||
                                           m.MediaType == MediaType.Powerpoint ||
                                           m.MediaType == MediaType.Word ||
                                           m.MediaType == MediaType.Zip ||
                                           m.MediaType == MediaType.AnderDocument)).OrderBy(m => m.MediaType).ToList();
            Afbeeldingen      = Media.Where(m => m.MediaType == MediaType.Afbeelding).ToList();
            HeeftLinken       = Linken.Any();
            HeeftVideos       = Videos.Any();
            HeeftDocumenten   = Documenten.Any();
            HeeftAfbeeldingen = Afbeeldingen.Any();

            this.GebruikersIngeschreven    = sessie.GebruikersIngeschreven.OrderBy(gi => gi.AanwezigBevestiged).ThenBy(gi => gi.Voornaam).ThenBy(gi => gi.Achternaam);
            this.HeeftInschrevenGebruikers = GebruikersIngeschreven.Any();
            this.Afgelopen            = sessie.Gesloten;
            this.SessieAankondigingen = sessie.Aankondingen;
        }
예제 #12
0
        public async Task AddVideo(string id)
        {
            const string url = "http://www.nicovideo.jp/api/deflist/add?item_type=0&item_id={0}&description={1}&token={2}";

            if (!Videos.Any(v => v.VideoId == id))
            {
                // インスタンス作成
                var video = await VideoModel.CreateInstance(id);

                // URLに追加
                var txt = await GetStringAsync(string.Format(url, await GetItemId(video.VideoId), "", await GetToken()));

                // ステータス更新
                video.Status = VideoStatus.New;

                // 自身に追加
                Videos.Insert(0, video);

                // 履歴に追加
                await AddHistory(video.VideoId);

                MainViewModel.Instance.TemporaryCount = Videos.Count;
            }
        }
예제 #13
0
        public List <Video> GetByVideoMiolo(VideoMiolo vm, string matricula = null, Aplicacoes IdAplicacao = Aplicacoes.MsProMobile, string VersaoApp = "")
        {
            var lstVideosMiolo = new VideosMiolo();
            var videos         = _vimeoRepository.GetByFilters(vm).ToList();
            var chaveamento    = new ChaveamentoVimeoMediMiolo();

            foreach (var item in videos)
            {
                VideoMiolo v = new VideoMiolo()
                {
                    ID          = item.IDApostila.ToString(),
                    VideoID     = item.VideoID,
                    IDApostila  = item.IDApostila,
                    CodigoVideo = item.CodigoVideo,
                    BorKey      = _vimeoRepository.GetBorKey(item.CodigoVideo, item.Ano, item.IDApostila),
                    Qualidade   = vm.Qualidade,
                };

                tblVideo    video        = _vimeoRepository.GetVideoVimeo(null, Convert.ToInt32(item.VideoID));
                VideoUrlDTO videoRetorno = new VideoUrlDTO
                {
                    Url = string.Empty
                };

                var chaveamentoVimeo = chaveamento.GetChaveamento();
                if (chaveamentoVimeo)
                {
                    if ((int)IdAplicacao == (int)Aplicacoes.MEDSOFT_PRO_ELECTRON || (int)IdAplicacao == (int)Aplicacoes.AreaRestrita)
                    {
                        v.URL = video.txtUrlStreamVimeo;
                    }
                    else
                    {
                        v.URL = video.txtUrlVimeo;
                    }
                }

                if (video.intVimeoID == null)
                {
                    ValidarEnvioEmailVideoDefeituoso(video);
                }
                else if (v.URL == null)
                {
                    v.URL = _vimeoRepository.GetUrlPlataformaVideo(video, chaveamentoVimeo, (int)IdAplicacao);
                    if (v.URL == string.Empty)
                    {
                        ValidarEnvioEmailVideoDefeituoso(video);
                    }
                }

                v.HTTPURL  = v.URL;
                v.URLThumb = _vimeoRepository.GetUrlThumb(video, new ChaveamentoVimeoMediMiolo(), VersaoApp);
                v.Links    = _vimeoRepository.GetLinksVideoVariasQualidades(video.txtVideoInfo, v.URL);

                lstVideosMiolo.Add(v);
            }

            var lstv = new Videos();

            foreach (var valor in lstVideosMiolo)
            {
                if (!lstv.Any(i => i.Url.Equals(valor.HTTPURL)))
                {
                    var video = new Video();
                    video.ID      = Convert.ToInt32(valor.ID);
                    video.VideoId = valor.VideoID;
                    video.Url     = valor.HTTPURL;
                    video.Thumb   = valor.URLThumb;
                    video.Links   = valor.Links;
                    video         = _vimeoRepository.CreateVideoObject(video, matricula);
                    lstv.Add(video);
                }
            }

            return(lstv);
        }
예제 #14
0
 public bool IsTemporary(string id)
 {
     return(Videos.Any(video => video.VideoId == id));
 }
예제 #15
0
 public bool IsNew(string id)
 {
     return(Videos.Any(video => video.VideoId == id && video.Status == VideoStatus.New));
 }