private void Window_KeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Right: if (Popup_IsOpen) { setReminder.Background = (LinearGradientBrush)FindResource("ButtonNormalBackground"); setReminder.BorderBrush = std_border_color; setReminder.BorderThickness = std_border_thickness; cancel.Background = (LinearGradientBrush)FindResource("ButtonHoverBackground"); cancel.BorderBrush = hover_border_color; cancel.BorderThickness = hover_border_thickness; currently_on_set_reminder = false; } else { if (lb.SelectedIndex < MAX_LBI_INDEX) { lb.SelectedIndex += 1; } lb.ScrollIntoView(lb.SelectedItem); } break; case Key.Left: if (Popup_IsOpen) { setReminder.Background = (LinearGradientBrush)FindResource("ButtonHoverBackground"); setReminder.BorderBrush = hover_border_color; setReminder.BorderThickness = hover_border_thickness; cancel.Background = (LinearGradientBrush)FindResource("ButtonNormalBackground"); cancel.BorderBrush = std_border_color; cancel.BorderThickness = std_border_thickness; currently_on_set_reminder = true; } else { if (lb.SelectedIndex > 0) { lb.SelectedIndex -= 1; } lb.ScrollIntoView(lb.SelectedItem); } break; case Key.Down: if (Popup_IsOpen) { } else { lb.SelectedIndex = 0; lb.ScrollIntoView(lb.SelectedItem); lb.SelectedIndex = -1; if (lb_index < MAX_LB_INDEX) { lb_index += 1; } lb = List_boxes[lb_index]; lb.SelectedIndex = 0; lb.ScrollIntoView(lb.SelectedItem); lb.BringIntoView(); } break; case Key.Up: if (Popup_IsOpen) { } else { lb.SelectedIndex = 0; lb.ScrollIntoView(lb.SelectedItem); lb.SelectedIndex = -1; if (lb_index > 0) { lb_index -= 1; } lb = List_boxes[lb_index]; lb.SelectedIndex = 0; lb.ScrollIntoView(lb.SelectedItem); lb.BringIntoView(); if (lb_index == 0) { recommendations_label.BringIntoView(); } } break; case Key.O: if (!Popup_IsOpen) { //Selected sherlock if (lb == List_boxes[0] && lb.SelectedIndex == 0) { channel = 1; LiveTV livetv = new LiveTV(channel); livetv.Show(); this.Close(); } else { //Selected Topgear or one of first two shows in any category if ((lb == List_boxes[0] && lb.SelectedIndex == 1) || lb.SelectedIndex < 2) { channel = 2; LiveTV livetv = new LiveTV(channel); livetv.Show(); this.Close(); } //else show is not on else { Popup_IsOpen = true; } } } //Pop is open else { //when set reminder was pressed if (currently_on_set_reminder) { popup_message.Text = "Reminder has been set!"; done.Opacity = 100; cancel.Opacity = 0; setReminder.Opacity = 0; currently_on_set_reminder = false; } else { //back to default setReminder.Background = (LinearGradientBrush)FindResource("ButtonNormalBackground"); setReminder.BorderBrush = std_border_color; setReminder.BorderThickness = std_border_thickness; cancel.Background = (LinearGradientBrush)FindResource("ButtonHoverBackground"); cancel.BorderBrush = hover_border_color; cancel.BorderThickness = hover_border_thickness; setReminder.Opacity = 100; cancel.Opacity = 100; done.Opacity = 0; popup_message.Text = "Would you like to set a reminder for this show?"; Popup_IsOpen = false; } } break; case Key.Back: MainWindow mainwindow = new MainWindow(); mainwindow.Show(); this.Close(); break; case Key.OemQuestion: Settings settings = new Settings(); settings.Show(); this.Close(); break; case Key.S: Search search = new Search(); search.Show(); this.Close(); break; case Key.H: MainWindow mainw = new MainWindow(); mainw.Show(); this.Close(); break; case Key.Z: Notification_tab not = new Notification_tab(); not.Show(); this.Close(); break; default: break; } }