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); } }
private void ImportUrlCmdHandler(object sender, ExecutedRoutedEventArgs e) { ImportUrlWin win = new ImportUrlWin(); win.Owner = this; win.WindowStartupLocation = WindowStartupLocation.CenterOwner; if ((bool)win.ShowDialog()) { IRemoteUrl ui = win.ImportUrl; playFromUrl(ui); } }
private bool checkEqual(IUrl ui, PlayControlViewModel vm) { if (ui is ILocalUrl) { return(ui.LocalPath == vm.Source.LocalSourcePath); } else if (ui is IRemoteUrl) { IRemoteUrl ru = ui as IRemoteUrl; return(ru.SourceIp == vm.Source.Storage.Ip && ru.SourcePort == vm.Source.Storage.Port && ru.BeginTime == vm.PlaySlider.BeginTime && ru.EndTime == vm.PlaySlider.EndTime); } return(false); }
private void onNewDownloads() { NewTaskWin ntWin = new NewTaskWin(); ntWin.Owner = System.Windows.Application.Current.MainWindow; if ((bool)ntWin.ShowDialog()) { IRemoteUrl ui = ntWin.ViewModel.GetParsedUrlInfo(); string downPath = System.IO.Path.Combine(ntWin.ViewModel.DownloadDirectory, ntWin.ViewModel.DownloadName); var downArray = ui.VideoInfos.Select(vi => new DownloadInfoParam(ui.SourceIp, ui.SourcePort, ui.BeginTime, ui.EndTime, vi.VideoId, vi.StreamId, downPath, vi.VideoName)).ToArray(); var handle = NewDownloadsEvent; if (handle != null && downArray != null && downArray.Length > 0) { handle(downArray); } } }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { IRemoteUrl ui = RemoteUrl.Parse(txtUrl.Text.Trim()) as IRemoteUrl; if (ui == null) { DialogUtil.ShowWarning("不支持导入数据源格式。"); return; } ImportUrl = ui; this.DialogResult = true; this.Close(); } catch (Exception ex) { Common.Log.Logger.Default.Error(ex); DialogUtil.ShowError(ex.Message); } }