Beispiel #1
0
        private void Compare_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Close();
            }
            else if (e.KeyCode == Keys.Enter && buttonNextDifference.Enabled)
            {
                ButtonNextDifferenceClick(null, null);
            }
            else if (e.KeyCode == Keys.Right && buttonNextDifference.Enabled)
            {
                ButtonNextDifferenceClick(null, null);
            }
            else if (e.KeyCode == Keys.Left && buttonPreviousDifference.Enabled)
            {
                ButtonPreviousDifferenceClick(null, null);
            }
            else if (_mainGeneralGoToNextSubtitle == e.KeyData || (e.KeyCode == Keys.Down && e.Modifiers == Keys.Alt))
            {
                SubtitleListView lv = subtitleListView1;
                if (subtitleListView2.Focused)
                {
                    lv = subtitleListView2;
                }

                int selectedIndex = 0;
                if (lv.SelectedItems.Count > 0)
                {
                    selectedIndex = lv.SelectedItems[0].Index;
                    selectedIndex++;
                }
                lv.SelectIndexAndEnsureVisible(selectedIndex);
            }
            else if (_mainGeneralGoToPrevSubtitle == e.KeyData || (e.KeyCode == Keys.Up && e.Modifiers == Keys.Alt))
            {
                SubtitleListView lv = subtitleListView1;
                if (subtitleListView2.Focused)
                {
                    lv = subtitleListView2;
                }

                int selectedIndex = 0;
                if (lv.SelectedItems.Count > 0)
                {
                    selectedIndex = lv.SelectedItems[0].Index;
                    selectedIndex--;
                }
                lv.SelectIndexAndEnsureVisible(selectedIndex);
            }
        }
Beispiel #2
0
 private void SyncListViews(ListView listViewSelected, SubtitleListView listViewOther)
 {
     if (listViewSelected.SelectedItems.Count > 0)
     {
         var first = listViewSelected.TopItem.Index;
         int index = listViewSelected.SelectedItems[0].Index;
         if (index < listViewOther.Items.Count)
         {
             listViewOther.SelectIndexAndEnsureVisible(index, false);
             if (first >= 0)
             {
                 listViewOther.TopItem = listViewOther.Items[first];
             }
         }
     }
 }