/// <summary>
 /// 左移
 /// </summary>
 /// <param name="index"></param>
 public void MoveLeft(int index)
 {
     if (index > 0)
     {
         VideoItems.Move(index, index - 1);
     }
 }
 /// <summary>
 /// 右移
 /// </summary>
 /// <param name="index"></param>
 public void MoveRight(int index)
 {
     if (index < VideoItems.Count - 1)
     {
         VideoItems.Move(index, index + 1);
     }
 }
Example #3
0
        private async Task LoadDataAsync()
        {
            var list = await videoLibrary.GetVideoItemsAsync(Directory, false);

            VideoItems.Clear();
            VideoItems.AddRange(list.OrderBy(e => e.Title));
        }
Example #4
0
        protected Action MediaStop;      //视频播放结束后执行动作
        public ControllerBase(APlayer player)
        {
            this.MediaPlayer              = player;
            this.MediaPlayer.MediaStoped += MediaPlayer_MediaStoped;
            string path = Application.StartupPath + @"\Videos";

            VideoSources = VideoItemDAL.GetVideoSources(path);
            udp          = new NetUdp();
            udp.UdpProcess(MessageProcess);
        }
 /// <summary>
 /// 获取更新数据
 /// </summary>
 public void GetData()
 {
     foreach (SeatManage.ClassModel.PlaylistItemInfo item in PlaylistModel.MediaPlayList)
     {
         SeatManage.Bll.FileOperate fileDownload = new SeatManage.Bll.FileOperate();
         string filePath = string.Format(@"{0}temp\{1}", AppDomain.CurrentDomain.BaseDirectory, item.MediaFileName.Split('_')[1]);
         if (fileDownload.FileDownLoad(filePath, item.MediaFileName, SeatManage.EnumType.SeatManageSubsystem.PlaylistAd))
         {
             VideoItems.Add(GetNewItme(filePath));
         }
     }
 }
Example #6
0
        protected override async Task InitializeVMAsync(CancellationToken token)
        {
            App.DebugLog("");

            var list = await videoLibrary.GetVideoItemsAsync(Directory, false);

            VideoItems.Clear();
            if (backToTrimmer)
            {
                VideoItems.AddRange(list.OrderBy(e => e.Directory).ThenBy(e => e.FileName));
            }
            else
            {
                VideoItems.AddRange(list.OrderBy(e => e.Title));
            }
        }
Example #7
0
 /// <summary>
 /// 获取更新数据
 /// </summary>
 public void GetData()
 {
     foreach (AMS.Model.PlaylistItemInfo item in PlaylistModel.MediaPlayList)
     {
         if (!Directory.Exists(string.Format(@"{0}temp", AppDomain.CurrentDomain.BaseDirectory)))
         {
             Directory.CreateDirectory(string.Format(@"{0}temp", AppDomain.CurrentDomain.BaseDirectory));
         }
         AMS.ServiceProxy.FileOperate fileDownload = new AMS.ServiceProxy.FileOperate();
         string filePath = string.Format(@"{0}temp\{1}", AppDomain.CurrentDomain.BaseDirectory, item.MediaFileName.Split('_')[1]);
         if (fileDownload.FileDownLoad(filePath, item.MediaFileName, SeatManage.EnumType.SeatManageSubsystem.PlaylistAd) == "")
         {
             VideoItems.Add(GetNewItme(filePath));
         }
     }
 }
Example #8
0
        private void Page_Load(object sender, EventArgs e)
        {
            //Detect WebDav Support in PageEditor
            if (Request.Browser.Browser.Contains("IE") && Sitecore.Context.PageMode.IsPageEditor)
            {
                if (FileDrop != null)
                {
                    FileDrop.Visible = true;
                }
            }

            //Page Mode Detection
            AutoScroll = Sitecore.Context.PageMode.IsPageEditor ? "false" : "true";

            //Debug Mode
            if (Sitecore.Context.PageMode.IsDebugging)
            {
                //Put in Debug Information here about marketing information.
            }

            //Rendering Parameter Templates
            string rawParameters           = Attributes["sc_parameters"];
            NameValueCollection parameters = Sitecore.Web.WebUtil.ParseUrlParameters(rawParameters);

            GetMaxItems          = parameters["Max Items"] ?? "5";
            GetSlideDelay        = parameters["Slide Delay"] ?? "6000";
            GetDetailsSlideDelay = parameters["Detail Slide Duration"] ?? "1000";
            GetTransitionType    = parameters["Transition Type"] ?? "swing";

            var            getDataSource = Sitecore.Context.Database.GetItem(DataSource);
            MultilistField imageList     = getDataSource.Fields["Image List"];
            MultilistField videoList     = getDataSource.Fields["Video List"];


            //DetailsList.DataSource =
            ImageItems.DataSource = imageList.GetItems();
            VideoItems.DataSource = videoList.GetItems();

            var combinedItems = new List <Item>(imageList.GetItems());

            combinedItems.AddRange(videoList.GetItems());

            DetailsList.DataSource = combinedItems;
            DetailsList.DataBind();
            ImageItems.DataBind();
            VideoItems.DataBind();
        }
Example #9
0
        public static VideoItems GetVideoSources(string path)
        {
            var        pattern    = ".avi|.mp4|.mov|.rmvb|.wmv|.flv|.f4v|.vob|.mpg|.mkv|.3gp|.rm";
            var        sourceList = FileHelper.FindFiles(path, pattern);
            VideoItems items      = new VideoItems();

            if (items != null)
            {
                foreach (var v in sourceList)
                {
                    items.Add(new VideoItem {
                        Path = v
                    });
                }
            }
            return(items);
        }
 /// <summary>
 /// 删除项
 /// </summary>
 /// <param name="index"></param>
 public void ItemDelete(int index)
 {
     VideoItems.RemoveAt(index);
 }
        private void VideoItemFlyout_Opening(object sender, object e)
        {
            object dataContext = Target.DataContext ?? (Target as SelectorItem)?.Content;
            var    content     = (dataContext as Interfaces.IVideoContent);

            if (content == null || (VideoItems?.Any() ?? false))
            {
                content     = VideoItems?.First();
                dataContext = VideoItems;
            }

            bool isMultipleSelection = VideoItems?.Count >= 2;

            var playlist = Playlist;


            // 視聴履歴
            RemoveWatchHisotryItem.Visibility = (content is IWatchHistory).ToVisibility();

            // ローカルプレイリスト
            if (playlist is LocalPlaylist localPlaylist)
            {
                RemoveLocalPlaylistItem.CommandParameter = dataContext;
                RemoveLocalPlaylistItem.Command          = localPlaylist.ItemsRemoveCommand;
                RemoveLocalPlaylistItem.Visibility       = Visibility.Visible;
            }
            else
            {
                RemoveLocalPlaylistItem.Visibility = Visibility.Collapsed;
            }

            // マイリスト
            if (playlist is LoginUserMylistPlaylist mylistPlaylist)
            {
                RemoveMylistItem.CommandParameter = dataContext;
                RemoveMylistItem.Command          = mylistPlaylist.ItemsRemoveCommand;
                RemoveMylistItem.Visibility       = Visibility.Visible;
            }
            else
            {
                RemoveMylistItem.Visibility = Visibility.Collapsed;
            }

            // キュー
            AddQueue.CommandParameter    = dataContext;
            RemoveQueue.CommandParameter = dataContext;
            if (isMultipleSelection)
            {
                AddQueue.Visibility    = VideoItems.All(x => HohoemaPlaylist.QueuePlaylist.Contains(x)).ToInvisibility();
                RemoveQueue.Visibility = VideoItems.Any(x => HohoemaPlaylist.QueuePlaylist.Contains(x)).ToVisibility();
            }
            else if (HohoemaPlaylist.QueuePlaylist.Contains(content))
            {
                AddQueue.Visibility    = Visibility.Collapsed;
                RemoveQueue.Visibility = Visibility.Visible;
            }
            else
            {
                AddQueue.Visibility    = Visibility.Visible;
                RemoveQueue.Visibility = Visibility.Collapsed;
            }

            // あとで見る
            AddWatchAfter.CommandParameter    = dataContext;
            RemoveWatchAfter.CommandParameter = dataContext;
            if (isMultipleSelection)
            {
                AddWatchAfter.Visibility    = VideoItems.All(x => HohoemaPlaylist.WatchAfterPlaylist.Contains(x)).ToInvisibility();
                RemoveWatchAfter.Visibility = VideoItems.Any(x => HohoemaPlaylist.WatchAfterPlaylist.Contains(x)).ToVisibility();
            }
            else if (HohoemaPlaylist.WatchAfterPlaylist.Contains(content))
            {
                AddWatchAfter.Visibility    = Visibility.Collapsed;
                RemoveWatchAfter.Visibility = Visibility.Visible;
            }
            else
            {
                AddWatchAfter.Visibility    = Visibility.Visible;
                RemoveWatchAfter.Visibility = Visibility.Collapsed;
            }


            // マイリスト
            AddToMylistSubItem.Items.Clear();
            AddToMylistSubItem.Visibility = UserMylistManager.IsLoginUserMylistReady ? Visibility.Visible : Visibility.Collapsed;
            if (UserMylistManager.IsLoginUserMylistReady)
            {
                AddToMylistSubItem.Items.Add(new MenuFlyoutItem()
                {
                    Text             = _localizedText_CreateNew,
                    Command          = CreateMylistCommand,
                    CommandParameter = dataContext
                });

                foreach (var mylist in UserMylistManager.Mylists)
                {
                    AddToMylistSubItem.Items.Add(new MenuFlyoutItem()
                    {
                        Text             = mylist.Label,
                        Command          = mylist.ItemsAddCommand,
                        CommandParameter = dataContext
                    });
                }
            }

            var visibleSingleSelectionItem = isMultipleSelection.ToInvisibility();

            OpenVideoInfoPage.Visibility      = visibleSingleSelectionItem;
            OpenOwnerVideosPage.Visibility    = visibleSingleSelectionItem;
            AddNgUser.Visibility              = visibleSingleSelectionItem;
            VideoInfoItemSeparator.Visibility = visibleSingleSelectionItem;


            //OpenOwnerSeriesPage.Visibility = (content?.ProviderType == Database.NicoVideoUserType.User && content?.ProviderId != null).ToVisibility();
            //OpenOwnerSeriesPage.CommandParameter = content?.ProviderId;

            Share.Visibility       = visibleSingleSelectionItem;
            CopySubItem.Visibility = visibleSingleSelectionItem;

            SusbcriptionSubItem.Visibility = visibleSingleSelectionItem;


            // プレイリスト
            LocalMylistSubItem.Items.Clear();
            LocalMylistSubItem.Items.Add(new MenuFlyoutItem()
            {
                Text             = _localizedText_CreateNew,
                Command          = CreateLocalMylistCommand,
                CommandParameter = dataContext
            });

            foreach (var localMylist in LocalMylistManager.LocalPlaylists)
            {
                LocalMylistSubItem.Items.Add(new MenuFlyoutItem()
                {
                    Text             = localMylist.Label,
                    Command          = localMylist.ItemsAddCommand,
                    CommandParameter = dataContext
                });
            }

            // 購読
            var susbcSourceConverter = new Subscriptions.SubscriptionSourceConverter();
            var subscSource          = susbcSourceConverter.Convert(content, typeof(SubscriptionSource), null, null);

            SusbcriptionSubItem.Items.Clear();
            SusbcriptionSubItem.Items.Add(new MenuFlyoutItem()
            {
                Text             = _localizedText_CreateNew,
                Command          = CreateSubscriptionGroupCommand,
                CommandParameter = subscSource
            });

            foreach (var subsc in SubscriptionManager.Subscriptions)
            {
                SusbcriptionSubItem.Items.Add(new MenuFlyoutItem()
                {
                    Text             = subsc.Label,
                    Command          = subsc.AddSource,
                    CommandParameter = subscSource
                });
            }

            // NG投稿者
            AddNgUser.Visibility    = AddNgUser.Command.CanExecute(content).ToVisibility();
            RemoveNgUser.Visibility = RemoveNgUser.Command.CanExecute(content).ToVisibility();


            // キャッシュ
            var isCacheEnabled          = VideoCacheManager.CacheSettings.IsEnableCache && VideoCacheManager.CacheSettings.IsUserAcceptedCache;
            var cacheEnableToVisibility = isCacheEnabled.ToVisibility();

            if (isMultipleSelection && isCacheEnabled)
            {
                // 一つでもキャッシュ済みがあれば削除ボタンを表示
                // 一つでも未キャッシュがあれば取得ボタンを表示
                var anyItemsCached    = VideoItems.Any(x => VideoCacheManager.IsCacheRequested(x.Id));
                var anyItemsNotCached = VideoItems.Any(x => !VideoCacheManager.CheckCachedAsyncUnsafe(x.Id));

                var notCachedToVisible = (anyItemsNotCached).ToVisibility();
                CacheRequest.Visibility             = notCachedToVisible;
                CacheRequest.CommandParameter       = dataContext;
                CacheRequestWithQuality.Visibility  = notCachedToVisible;
                DeleteCacheRequest.CommandParameter = dataContext;

                CacheSeparator.Visibility = Visibility.Visible;

                var cachedToVisible = (anyItemsCached).ToVisibility();
                DeleteCacheRequest.Visibility = cachedToVisible;
            }
            else if (isCacheEnabled)
            {
                var itemCached    = VideoCacheManager.IsCacheRequested(content.Id);
                var itemNotCached = !VideoCacheManager.CheckCachedAsyncUnsafe(content.Id);

                var notCachedToVisible = (itemNotCached).ToVisibility();
                CacheRequest.Visibility             = notCachedToVisible;
                CacheRequest.CommandParameter       = dataContext;
                CacheRequestWithQuality.Visibility  = notCachedToVisible;
                DeleteCacheRequest.CommandParameter = dataContext;

                CacheSeparator.Visibility = Visibility.Visible;

                var cachedToVisible = (itemCached).ToVisibility();
                DeleteCacheRequest.Visibility = cachedToVisible;
            }
            else
            {
                CacheRequest.Visibility            = Visibility.Collapsed;
                CacheRequestWithQuality.Visibility = Visibility.Collapsed;
                CacheSeparator.Visibility          = Visibility.Collapsed;
                DeleteCacheRequest.Visibility      = Visibility.Collapsed;
            }


            if (CacheRequestWithQuality.Items.Count == 0)
            {
                foreach (var quality in Enum.GetValues(typeof(NicoVideoQuality)).Cast <NicoVideoQuality>().Where(x => x.IsDmc() && x != NicoVideoQuality.Unknown))
                {
                    var command = App.Current.Container.Resolve <CacheAddRequestCommand>();
                    command.VideoQuality = quality;
                    var cacheRequestMenuItem = new MenuFlyoutItem()
                    {
                        Text    = quality.Translate(),
                        Command = command,
                    };
                    CacheRequestWithQuality.Items.Add(cacheRequestMenuItem);
                }
            }

            foreach (var qualityCacheRequest in CacheRequestWithQuality.Items)
            {
                (qualityCacheRequest as MenuFlyoutItem).CommandParameter = dataContext;
            }


            // 選択
            if (!VideoItemsSelectionContext.IsSelectionEnabled)
            {
                SelectionStart.Visibility = Visibility.Visible;
                SelectionEnd.Visibility   = Visibility.Collapsed;
                SelectionAll.Visibility   = Visibility.Collapsed;
            }
            else
            {
                SelectionStart.Visibility = Visibility.Collapsed;
                SelectionEnd.Visibility   = Visibility.Visible;
                SelectionAll.Visibility   = Visibility.Visible;
            }
        }
Example #12
0
        protected override void OnInitialized()
        {
            var video1 = new VideoDto
            {
                Title       = "Tyranny",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = "",
                Link        = "https://www.youtube.com/watch?v=0HU1rMDGyB8&t=202s"
            };

            var video2 = new VideoDto
            {
                Title       = "Nerium",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.This is a wider card with supporting text below as a natural lead-in to additional content",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = @"img\Eka logo.jpeg",
                Link        = "https://www.youtube.com/watch?v=BL2NHqc74sQ&ab_channel=NERIUMOFFICIALNERIUMOFFICIAL"
            };

            var video3 = new VideoDto
            {
                Title       = "Whiskey Blues",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = @"img\tattoo\leon.jpeg",
                Link        = "https://www.youtube.com/watch?v=f5jGX9A6ErA&ab_channel=JAZZ%26BLUESJAZZ%26BLUES"
            };

            var video4 = new VideoDto
            {
                Title       = "Bra vs Ger",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = @"img\Eka logo.jpeg",
                Link        = "https://www.youtube.com/watch?v=m3HZKHTLHDU&ab_channel=RptimaoTV2RptimaoTV2"
            };

            var video5 = new VideoDto
            {
                Title       = "The Witcher",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = "",
                Link        = "https://www.youtube.com/watch?v=PyYlB_MVuLM"
            };

            var video6 = new VideoDto
            {
                Title       = "Breaking Bad",
                Description = "This is a wider card with supporting text below as a natural lead-in to additional content.",
                Date        = new DateTime(2020, 12, 12),
                ImageSource = "",
                Link        = "https://www.youtube.com/watch?v=NQ1n5KHTAvo&ab_channel=Shane"
            };

            VideoItems.Add(video1);
            VideoItems.Add(video2);
            VideoItems.Add(video3);
            VideoItems.Add(video4);
            VideoItems.Add(video5);
            VideoItems.Add(video6);
        }
Example #13
0
        public bool Validate(CustomValidationService service)
        {
            ValidationErrors = new SerializableDictionary <string, string>();

            if ((PhoneItems == null || PhoneItems.Count < 1) &&
                (InternetItems == null || InternetItems.Count < 1) &&
                (VideoItems == null || VideoItems.Count < 1))
            {
                ValidationErrors.Add(LambdaHelper <Location> .GetPropertyName(x => x.PhoneItems), "Location.PhoneItems is a mandatory field.");
                ValidationErrors.Add(LambdaHelper <Location> .GetPropertyName(x => x.InternetItems), "Location.InternetItems is a mandatory field.");
                ValidationErrors.Add(LambdaHelper <Location> .GetPropertyName(x => x.VideoItems), "Location.VideoItems is a mandatory field.");
            }

            if (PhoneItems != null && PhoneItems.Any())
            {
                foreach (var item in PhoneItems)
                {
                    if (item.Validate(service))
                    {
                        foreach (var validationError in item.ValidationErrors)
                        {
                            if (!ValidationErrors.ContainsKey(validationError.Key))
                            {
                                ValidationErrors.Add(validationError.Key, validationError.Value);
                            }
                        }
                    }
                }
            }

            if (InternetItems != null)
            {
                if (InternetItems != null && InternetItems.Any())
                {
                    foreach (var item in InternetItems)
                    {
                        if (item.Validate(service))
                        {
                            foreach (var validationError in item.ValidationErrors)
                            {
                                if (!ValidationErrors.ContainsKey(validationError.Key))
                                {
                                    ValidationErrors.Add(validationError.Key, validationError.Value);
                                }
                            }
                        }
                    }
                }
            }

            if (VideoItems != null)
            {
                if (VideoItems != null && VideoItems.Any())
                {
                    foreach (var item in VideoItems)
                    {
                        if (item.Validate(service))
                        {
                            foreach (var validationError in item.ValidationErrors)
                            {
                                if (!ValidationErrors.ContainsKey(validationError.Key))
                                {
                                    ValidationErrors.Add(validationError.Key, validationError.Value);
                                }
                            }
                        }
                    }
                }
            }

            if (Address == null)
            {
                ValidationErrors.Add(LambdaHelper <Location> .GetPropertyName(x => x.Address), "Location.Address is a mandatory field.");
            }
            else
            {
                if (Address.Validate())
                {
                    foreach (var validationError in Address.ValidationErrors)
                    {
                        if (!ValidationErrors.ContainsKey(validationError.Key))
                        {
                            ValidationErrors.Add(validationError.Key, validationError.Value);
                        }
                    }
                }
            }

            return(ValidationErrors.Count > 0);
        }
 public VideoItemViewModel(VideoItems video)
 {
     this.Video = video;
 }