protected override void DoBeginPreview(string item, object additionalData) { MediaRendererInstance.Instance.RenderPanel = renderingZone1; _sub = additionalData as Subtitle; if (_sub != null) { MediaRendererInstance.Instance.SetRenderFile(_sub.VideoFileInfo.Path); MediaRendererInstance.Instance.StartRenderer(); MediaRendererInstance.Instance.PauseRenderer(); } }
private void HandleAction(ToolAction action) { if (!IsToolActionEnabled(action)) return; switch (action) { case ToolAction.ToolActionNew: _sub = Subtitle.Empty; lvSubtitles.Subtitle = _sub; break; case ToolAction.ToolActionOpen: { OPMOpenFileDialog dlg = CommonDialogHelper.NewOPMOpenFileDialog(); dlg.Title = Translator.Translate("TXT_OPEN_SUBTITLE"); dlg.Filter = "Subtitle files (*.srt, *.sub)|*.srt;*.sub||";//Translator.Translate("TXT_CATALOG_FILTER"); dlg.InitialDirectory = AppSettings.SUB_LastOpenedFolder; if (dlg.ShowDialog() == DialogResult.OK) { _sub = new Subtitle(dlg.FileName); AppSettings.SUB_LastOpenedFolder = Path.GetDirectoryName(dlg.FileName); lvSubtitles.Subtitle = _sub; List<string> items = new List<string>(); items.Add(dlg.FileName); base.RaiseNavigationAction(NavActionType.ActionDoubleClickFile, items, _sub); if (_sub.Elements != null && _sub.Elements.Count > 0) { lvSubtitles.Select(); lvSubtitles.Focus(); lvSubtitles.Items[0].Selected = true; //base.RaiseNavigationAction(NavActionType.ActionReloadPreview, items, _sub.Elements[0]); } } } break; case ToolAction.ToolActionSave: if (_sub.IsEmpty) { goto saveas; } else { _sub.Save(); } break; case ToolAction.ToolActionSaveAs: saveas: { OPMSaveFileDialog dlg = CommonDialogHelper.NewOPMSaveFileDialog(); dlg.Title = Translator.Translate("TXT_SAVE_SUBTITLE"); dlg.Filter = "Subtitle files (*.srt, *.sub)|*.srt;*.sub||";//Translator.Translate("TXT_CATALOG_FILTER"); dlg.AddExtension = true; dlg.DefaultExt = "srt"; dlg.InitialDirectory = AppSettings.SUB_LastOpenedFolder; if (dlg.ShowDialog() == DialogResult.OK) { _sub.SaveToFile(dlg.FileName); AppSettings.SUB_LastOpenedFolder = Path.GetDirectoryName(dlg.FileName); } } break; case ToolAction.ToolActionDelete: break; case ToolAction.ToolActionBack: break; case ToolAction.ToolActionFwd: break; case ToolAction.ToolActionSearch: break; case ToolAction.ToolActionRename: break; } }
public BaseSubtitleSupport(Subtitle sub, string file) { _sub = sub; _file = file; }
protected override void DoEndPreview() { MediaRendererInstance.Instance.StopRenderer(); _sub = null; }
internal MicroDvdSupport(Subtitle sub, string file) : base(sub, file) { }
internal SubRipSupport(Subtitle sub, string file) : base(sub, file) { }