private void ExportToSubStationAlphaassToolStripMenuItem_Click(object sender, EventArgs e) { var tab = MainTabControl.SelectedTab as MovieTab; if (tab == null) { return; } // Get the movie's fps var fpsDialog = new ValueDialog <float>( "Please enter the movie's fps (frames per second):", "Enter fps", 60, float.Parse, 0, float.MaxValue); float fps = 60; if (fpsDialog.ShowDialog() == DialogResult.OK) { fps = fpsDialog.Value; } else { return; } // Get the file name for the subtitles var fileDialog = new SaveFileDialog { Filter = "Sub Station Alpha|*.ass|All Files|*.*" }; var result = fileDialog.ShowDialog(); if (result != DialogResult.OK) { return; } // Get the text for the file var movie = tab.Movie as ISubtitled; var subtitles = movie.GetSubtitles(); var text = Subtitle.ToSubStationAlpha(subtitles, fps); // Write the file File.WriteAllText(fileDialog.FileName, text, Encoding.UTF8); // Confirm var message = $"Succesfully exported subtitles to {fileDialog.FileName}."; MessageBox.Show(message, "Success"); }
private void GoToFrameToolStripMenuItem_Click(object sender, EventArgs e) { if (MainTabControl.SelectedTab == null) { return; } var tab = MainTabControl.SelectedTab as MovieTab; var frameCount = tab.InputGrid.RowCount - 1; var dialog = new ValueDialog <int>("Enter frame:", "Jump To Frame", 0, int.Parse, 0, frameCount); if (dialog.ShowDialog() == DialogResult.OK) { GotoFrame(dialog.Value); } }