public void ChangeFps(double fps) { for (int i = 0; i < Chapters.Count; i++) { Chapter c = Chapters[i]; double frames = c.Time.TotalSeconds * FramesPerSecond; Chapters[i] = new Chapter() { Name = c.Name, Time = new TimeSpan((long)Math.Round(frames / fps * TimeSpan.TicksPerSecond)) }; } double totalFrames = Duration.TotalSeconds * FramesPerSecond; Duration = new TimeSpan((long)Math.Round((totalFrames / fps) * TimeSpan.TicksPerSecond)); FramesPerSecond = fps; }
/// <summary> /// shows an array of chapters in the GUI /// </summary> /// <param name="chaps">the chapters to be shown</param> private void showChapters(Chapter[] chaps) { this.chapterListView.Items.Clear(); foreach (Chapter chap in chaps) { ListViewItem item = new ListViewItem(new string[] {chap.timecode, chap.name}); item.Tag = chap; chapterListView.Items.Add(item); if (item.Index % 2 != 0) item.BackColor = Color.White; else item.BackColor = Color.WhiteSmoke; } }
private void addZoneButton_Click(object sender, System.EventArgs e) { Chapter c; if (chapterListView.Items.Count != 0) intIndex = chapterListView.Items.Count; else intIndex = 0; TimeSpan ts = new TimeSpan(0); try {//try to get a valid time input ts = TimeSpan.Parse(startTime.Text); } catch (Exception parse) { //invalid time input startTime.Focus(); startTime.SelectAll(); MessageBox.Show("Cannot parse the timecode you have entered.\nIt must be given in the hh:mm:ss.ccc format" + Environment.NewLine + parse.Message, "Incorrect timecode", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } //create a new chapter c = new Chapter() { Time = ts, Name = chapterName.Text }; pgc.Chapters.Insert(intIndex, c); FreshChapterView(); updateTimeLine(); }