private void ExportUrlCmdHandler(object sender, ExecutedRoutedEventArgs e) { ExportUrlChecker checker = new ExportUrlChecker(playCtrl.ViewModel); if (checker.CanExport) { ExportUrlWin win = new ExportUrlWin(); win.Owner = this; win.WindowStartupLocation = WindowStartupLocation.CenterOwner; win.SetExportUrl(checker.GetExportUrl()); win.ShowDialog(); } else { DialogUtil.ShowWarning("无法从当前状态生成URL:\n" + checker.ErrorMessage); } }
public void AddToPlay(string videoId, int streamId, string videoName) { if (PlaySlider.BeginTime >= PlaySlider.EndTime) { DialogUtil.ShowWarning("无效查询时间段。"); return; } if (Source == null) { DialogUtil.ShowWarning("无效的数据源。"); return; } VideoControlViewModel vm = null; string dictKey = null; if (Source.SrcType == SourceType.Local) { LocalDownloadInfoPacket param = new LocalDownloadInfoPacket(new VideoInfo(videoId, streamId, videoName), Source.LocalSourcePath); if (!isContained(param.Info)) { vm = new VideoControlViewModel(param, PlaySlider.BeginTime, PlaySlider.EndTime, _replayProcess); dictKey = buildKey(param.Info); } } else { DownloadInfoParam downloadInfo = new DownloadInfoParam(Source.Storage.Ip, Source.Storage.Port, PlaySlider.BeginTime, PlaySlider.EndTime, videoId, streamId, ConstSettings.CachePath, videoName); if (!isContained(downloadInfo)) { vm = new VideoControlViewModel(downloadInfo, _replayProcess); dictKey = buildKey(downloadInfo); } } if (vm != null && dictKey != null) { lock (_videoLockObj) { _dictVideoVMS[dictKey] = vm; } addOrRemoveVideoEvent(vm, true); onVideoAdded(vm); vm.ProgressOffset = PlaySlider.Slider / (double)PlaySlider.SliderMaximum; } }
private void doSnapshotCmd() { var img = DisplayModel.GetSnapshot(); if (img != null) { string name = DisplayModel.StreamManager.VideoName; if (string.IsNullOrWhiteSpace(name)) { name = "未知视频"; } PreviewWin.Show(img, name); } else { DialogUtil.ShowWarning("未获取到视频数据。"); } }
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); } }