private void RefreshSynchronizationPointsUi() { buttonApplySync.Enabled = _synchronizationPoints.Count > 0; labelNoOfSyncPoints.Text = string.Format(LanguageSettings.Current.PointSync.SyncPointsX, _synchronizationPoints.Count); listBoxSyncPoints.Items.Clear(); for (int i = 0; i < SubtitleListview1.Items.Count; i++) { if (_synchronizationPoints.ContainsKey(i)) { var p = new Paragraph { StartTime = { TotalMilliseconds = _synchronizationPoints[i].TotalMilliseconds } }; p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _subtitle.Paragraphs[i].Duration.TotalMilliseconds; SubtitleListview1.SetStartTimeAndDuration(i, p, _subtitle.GetParagraphOrDefault(i + 1), _subtitle.GetParagraphOrDefault(i - 1)); var item = new ListBoxSyncPoint { Index = i, Text = _subtitle.Paragraphs[i].Number + " - " + p.StartTime }; listBoxSyncPoints.Items.Add(item); SubtitleListview1.SetBackgroundColor(i, ColorTranslator.FromHtml("#6ebe6e")); SubtitleListview1.SetNumber(_subtitle.Paragraphs[i].Number, "* * * *"); } else { SubtitleListview1.SetBackgroundColor(i, SubtitleListview1.BackColor); SubtitleListview1.SetNumber(i, _subtitle.Paragraphs[i].Number.ToString(CultureInfo.InvariantCulture)); SubtitleListview1.SetStartTimeAndDuration(i, _subtitle.Paragraphs[i], _subtitle.GetParagraphOrDefault(i + 1), _subtitle.GetParagraphOrDefault(i - 1)); } } }
private void RefreshSynchronizationPointsUI() { buttonApplySync.Enabled = _synchronizationPoints.Count > 0; labelNoOfSyncPoints.Text = string.Format(Configuration.Settings.Language.PointSync.SyncPointsX, _synchronizationPoints.Count); listBoxSyncPoints.Items.Clear(); for (int i = 0; i < SubtitleListview1.Items.Count; i++) { if (_synchronizationPoints.ContainsKey(i)) { var p = new Paragraph(); p.StartTime.TotalMilliseconds = _synchronizationPoints[i].TotalMilliseconds; p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _subtitle.Paragraphs[i].Duration.TotalMilliseconds; SubtitleListview1.SetStartTimeAndDuration(i, p); var item = new ListBoxSyncPoint { Index = i, Text = _subtitle.Paragraphs[i].Number + " - " + p.StartTime }; listBoxSyncPoints.Items.Add(item); SubtitleListview1.SetBackgroundColor(i, Color.Green); SubtitleListview1.SetNumber(i, "* * * *"); } else { SubtitleListview1.SetBackgroundColor(i, SubtitleListview1.BackColor); SubtitleListview1.SetNumber(i, (i + 1).ToString(CultureInfo.InvariantCulture)); SubtitleListview1.SetStartTimeAndDuration(i, _subtitle.Paragraphs[i]); } } }
private void listBoxSyncPoints_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxSyncPoints.SelectedIndex >= 0) { ListBoxSyncPoint item = (ListBoxSyncPoint)listBoxSyncPoints.Items[listBoxSyncPoints.SelectedIndex]; SubtitleListview1.SelectIndexAndEnsureVisible(item.Index); } }
private void RefreshSynchronizationPointsUI() { buttonApplySync.Enabled = _synchronizationPoints.Count > 0; labelNoOfSyncPoints.Text = string.Format(Configuration.Settings.Language.PointSync.SyncPointsX, _synchronizationPoints.Count); listBoxSyncPoints.Items.Clear(); for (int i = 0; i < SubtitleListview1.Items.Count; i++) { if (_synchronizationPoints.ContainsKey(i)) { var p = new Paragraph(); p.StartTime.TotalMilliseconds = _synchronizationPoints[i].TotalMilliseconds; p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + _subtitle.Paragraphs[i].Duration.TotalMilliseconds; SubtitleListview1.SetStartTime(i, p); var item = new ListBoxSyncPoint { Index = i, Text = _subtitle.Paragraphs[i].Number + " - " + p.StartTime }; listBoxSyncPoints.Items.Add(item); SubtitleListview1.SetBackgroundColor(i, Color.Green); SubtitleListview1.SetNumber(i, "* * * *"); } else { SubtitleListview1.SetBackgroundColor(i, SubtitleListview1.BackColor); SubtitleListview1.SetNumber(i, (i + 1).ToString(CultureInfo.InvariantCulture)); SubtitleListview1.SetStartTime(i, _subtitle.Paragraphs[i]); } } }