public ImportInfoProxy(IRemoteUrl ui) { _ui = ui; _imgBytes = imageToBytes(Resources.DefaultThumbnail); if (!string.IsNullOrWhiteSpace(ui.LocalPath)) { _proxy = new VideoDataInfoProxy(); _proxy.TreeNodesReceived += proxy_TreeNodesReceived; _proxy.MessageReceived += proxy_MessageReceived; _proxy.UpdateSource(new VideoDataSource() { SrcType = SourceType.Local, LocalSourcePath = ui.LocalPath }); try { _proxy.GetVideoTreeNodesAsync(); } catch (Exception ex) { Logger.Default.Error("获取视频信息失败!", ex); string msg = "获取视频信息失败!\n" + ex.Message; DialogUtil.ShowError(msg); } } else { buildNodeRoot(ui.VideoInfos); } }
public SearcherViewModel() { _diProxy = new VideoDataInfoProxy(); _diProxy.VideoDataInfoReceived += diProxy_VideoDataInfoReceived; _searcherManager = new SearcherManager(); ResultsSource = new CollectionViewSource(); IsVisible = true; PropertyChanged += onPropertyChanged; _searcherManager.SearchResultEvent += onSearchResult; HomeCommand = new DelegateCommand(_ => onHome()); BackToPrevCommand = new DelegateCommand(_ => onBackToPrevCommand()); AllowDrag = true; SearchContext = string.Empty; //此举将导致树节点刷新 VideoInfoManager.Instance.DataSourceChanged += onDataSourceChanged; VideoInfoManager.Instance.LocalSourceInfoReceived += onNodeUpdated; }
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); } }