public VideoCollectionView(IntPtr handle) : base(handle) { // Initialize RegisterClassForCell(typeof(VideoCollectionViewCell), VideoDataSource.CardCellId); DataSource = new VideoDataSource(this); Delegate = new VideoViewDelegate(); }
protected override async void LoadState(object param, Dictionary <string, object> pageState) { base.LoadState(param, pageState); int id = (int)param; VideoDataItem item = VideoDataSource.GetItem(id); if (item != null) { OpenFile(item.File); } else if (pageState["fileToken"] != null) { StorageItemAccessList future = StorageApplicationPermissions.FutureAccessList; StorageFile file = await future.GetFileAsync(pageState["fileToken"] as string); future.Clear(); OpenFile(file); } if (pageState != null) { MediaPlayerState state = pageState["MediaState"] as MediaPlayerState; if (state != null) { MediaPlayer.RestorePlayerState(state); } } }
protected override void LoadState(Object param, Dictionary <String, Object> state) { int id = (int)param; VideoDataGroup group = VideoDataSource.GetGroup(id); DefaultViewModel["Items"] = group.Items; pageTitle.Text = group.Title; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // Get the video data from sharepoint site var videoDetail = VideoDataSource.GetVideos((String)navigationParameter); this.DefaultViewModel["Group"] = videoDetail; GetVideoFromLocal(videoDetail); }
public void UpdateSource(VideoDataSource src) { if (src == null) { throw new ErrorMessageException("视频数据源参数不能为空值。"); } Close(); _src = src; _localVideos = null; SourceValid = true; }
public int AddFile(StorageFile file, int groupID) { if (file != null && VideoExtensions.Contains(file.FileType)) { IEnumerable <VideoDataItem> matches = VideoDataSource.GetGroup(groupID).Items.Where(itm => itm.Path.Equals(file.Path)); if (matches.Count() > 0) { return(matches.First().ID); } VideoDataItem item = new VideoDataItem(VideoDataSource.NextID(), String.Empty, String.Empty, file); VideoDataSource.GetGroup(groupID).Items.Add(item); item.SetImage("ms-appx:///Assets/Thumbnail.png"); AddThumbnail(file, item); return(item.ID); } return(-1); }
private void onDataSourceChanged(object sender, EventArgs e) { //更新节点树。 if (string.IsNullOrWhiteSpace(SearchContext)) { updateFilteredVideos(); } else { SearchContext = string.Empty; } VideoDataSource src = VideoInfoManager.Instance.GetStorageSource(); //设置集中存储数据源 UpdateSource(src); }
public void UpdateSource(VideoDataSource src) { _diProxy.UpdateSource(src); if (src.SrcType == SourceType.Local) { try { _diProxy.GetVideoTreeNodesAsync(); } catch (Exception ex) { Logger.Default.Error("刷新本地数据源视频录像信息失败!", ex); string msg = "刷新本地数据源视频录像信息失败!\n" + ex.Message; DialogUtil.ShowError(msg); return; } } RefreshVideoDataSummary(); }
private void onDataSourceChanged(object sender, EventArgs e) { VideoDataSource src = VideoInfoManager.Instance.GetStorageSource(); if (src == null) { throw new ErrorMessageException("未配置有效的数据源!"); } if (src.SrcType == SourceType.Local && (string.IsNullOrEmpty(src.LocalSourcePath) || !new System.IO.DirectoryInfo(src.LocalSourcePath).Exists)) { throw new ErrorMessageException("未设置有效的本地视频路径!"); } if (src.SrcType == SourceType.Remote && src.Storage == null) { throw new ErrorMessageException("未配置集中存储服务!"); } //设置集中存储数据源 UpdateSource(src); }
private async void PopulateLibrary() { StorageFolder videos = KnownFolders.VideosLibrary; IReadOnlyList <StorageFile> files = await videos.GetFilesAsync(); foreach (StorageFile file in files) { AddFile(file, 1); } IReadOnlyList <StorageFolder> dirs = await videos.GetFoldersAsync(); foreach (StorageFolder dir in dirs) { int id = VideoDataSource.AddGroup(dir.DisplayName); files = await dir.GetFilesAsync(); foreach (StorageFile file in files) { AddFile(file, id); } } }
public LocalInfoProxy(string localPath) { _src = new VideoDataSource() { SrcType = SourceType.Local, LocalSourcePath = localPath }; _imgBytes = imageToBytes(Resources.DefaultThumbnail); _proxy = new VideoDataInfoProxy(); _proxy.TreeNodesReceived += proxy_TreeNodesReceived; _proxy.MessageReceived += proxy_MessageReceived; _proxy.UpdateSource(_src); try { _proxy.GetVideoTreeNodesAsync(); } catch (Exception e) { Logger.Default.Error("加载本地视频信息失败!", e); string msg = "加载本地视频信息失败!\n" + e.Message; DialogUtil.ShowError(msg); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var items = MasterListView.ItemsSource as List <Video>; if (items == null) { items = await VideoDataSource.GetInstance().GetPopularVideos(); MasterListView.ItemsSource = items; } if (e.Parameter != null && e.Parameter is Video) { _lastSelectedItem = (Video)e.Parameter; } UpdateForVisualState(AdaptiveStates.CurrentState); // Don't play a content transition for first item load. // Sometimes, this content will be animated as part of the page transition. DisableContentTransitions(); }
protected override void LoadState(Object param, Dictionary <String, Object> state) { DefaultViewModel["Groups"] = VideoDataSource.GetGroups(); }
private void RefreshClick(object sender, RoutedEventArgs e) { VideoDataSource.RefreshVideos(); //refresh the UI }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { var videoList = VideoDataSource.GetAllVideos(); this.DefaultViewModel["Groups"] = videoList; }
public Login() { this.InitializeComponent(); VideoDataSource.RefreshVideos(); }
public void UpdateSource(VideoDataSource src) { Clear(); this.Source = src; }
public void ClearRecentlyUsed() { StorageApplicationPermissions.MostRecentlyUsedList.Clear(); VideoDataSource.GetGroup(0).Items.Clear(); }