private void Window_KeyDown(object sender, KeyEventArgs e) { if (ProfilePopup.Visibility == Visibility.Hidden) { switch (e.Key) { case Key.Right: if (currentButtonSelectionIndex != 2 && currentButtonSelectionIndex != 5 && currentButtonSelectionIndex != 8 && currentButtonSelectionIndex != 9) { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = (currentButtonSelectionIndex + 1) % 9; setButtonFocus(currentButtonSelectionIndex); } break; case Key.Left: if (currentButtonSelectionIndex != 0 && currentButtonSelectionIndex != 3 && currentButtonSelectionIndex != 6 && currentButtonSelectionIndex != 9) { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = (currentButtonSelectionIndex - 1) % 9; setButtonFocus(currentButtonSelectionIndex); } break; case Key.Down: if (currentButtonSelectionIndex == 9) { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = 0; setButtonFocus(currentButtonSelectionIndex); } else if (currentButtonSelectionIndex < 6) { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = (currentButtonSelectionIndex + 3) % 9; setButtonFocus(currentButtonSelectionIndex); } break; case Key.Up: if (currentButtonSelectionIndex >= 3 && currentButtonSelectionIndex != 9) { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = (currentButtonSelectionIndex - 3) % 9; setButtonFocus(currentButtonSelectionIndex); } else { resetButtonFocus(currentButtonSelectionIndex); currentButtonSelectionIndex = 9; setButtonFocus(currentButtonSelectionIndex); } break; case Key.Z: if (e.Key == Key.Z) { //hardcoded to show notification Notification_popup0.Visibility = Visibility.Visible; //notifyDot.Visibility = Visibility.Visible; dispatcherTimer.Start(); } break; case Key.S: Settings settings = new Settings(); settings.Show(); this.Close(); break; case Key.G: TV_Guide tv = new TV_Guide(); tv.Show(); this.Close(); break; case Key.OemQuestion: Settings setting = new Settings(); setting.Show(); this.Close(); break; case Key.O: /*{ "Live TV", "Image/tv_icon.png" }, { "Gallery", "Image/gallery_icon.png" }, { "Music", "Image/music_icon.png" }, { "Recordings", "Image/record_icon.png" }, { "Search", "Image/search_icon.jpg" }, { "Netflix", "Image/netflix_icon.png" }, { "Settings", "Image/settings_icon.png" }, { "Notification", "Image/notification_icon.png" }, { "Other Apps", "Image/apps_icon.png" } , {"John Doe","Image/profile_icon.png" }*/ if (Notification_popup0.Visibility != Visibility.Visible) { bool dontClose = false; resetButtonFocus(currentButtonSelectionIndex); switch (content[currentButtonSelectionIndex, 0]) { case "Live TV": TV_Guide tvG = new TV_Guide(); tvG.Show(); break; case "Gallery": Photos_Videos gallery = new Photos_Videos(); gallery.Show(); break; case "Music": Music music = new Music(); music.Show(); break; case "Recordings": Recordings rec = new Recordings(); rec.Show(); break; case "Search": Search search = new Search(); search.Show(); break; case "Netflix": dontClose = true; MessageBox.Show("No screens made for third party"); break; case "Settings": Settings2 sett = new Settings2(); sett.Show(); break; case "Notification": Notification_tab notif = new Notification_tab(); notif.Show(); //notifyDot.Visibility = Visibility.Hidden; break; case "Other Apps": OtherApplications otherApp = new OtherApplications(); otherApp.Show(); content[6, 0] = "Prime Videos"; content[6, 1] = "Image/primevid_icon.png"; updateContent(6); break; default: //profile MainGrid.Effect = new BlurEffect(); dontClose = true; profileBtns.Clear(); ProfilePopup.Visibility = Visibility.Visible; Profiles_header.Visibility = Visibility.Visible; for (int i = 0; i < 2; i++) { Button profile = new Button(); profile.HorizontalContentAlignment = HorizontalAlignment.Center; StackPanel sPanel1 = new StackPanel(); sPanel1.HorizontalAlignment = HorizontalAlignment.Center; sPanel1.Orientation = Orientation.Vertical; Image image = new Image(); Uri imageUri = new Uri(profiles[i, 1], UriKind.Relative); image.Source = new BitmapImage(imageUri); image.Height = 55; image.Width = 55; sPanel1.Children.Add(image); profile.Name = "profile" + i.ToString(); TextBox textBox = new TextBox(); textBox.Background = Brushes.Transparent; textBox.Text = profiles[i, 0]; textBox.BorderBrush = Brushes.Transparent; profile.Height = 90; profile.Width = 170; textBox.FontSize = 20; sPanel1.Children.Add(textBox); profile.Content = sPanel1; profile.Background = (LinearGradientBrush)FindResource("ButtonNormalBackground"); profileBtns.Add(profile); ProfilePopup.Children.Add(profile); } //ProfilePopup.Children.Add setProfileButtonFocus(profileIndex); //Console.WriteLine(profileIndex); break; } if (!dontClose) { updateContent(currentButtonSelectionIndex); currentButtonSelectionIndex = 0; this.Close(); } } else { if (e.Key == Key.O) { LiveTV liveTV = new LiveTV(2); //notifyDot.Visibility = Visibility.Hidden; liveTV.Show(); this.Close(); } } break; default: break; } } else { } }
//FOLLOWING CODE IS NOT BEING USED****************************************** private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Back) { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } if (e.Key == Key.H) { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } if (e.Key == Key.Z) { //hardcoded to show notification Notification_popup0.Visibility = Visibility.Visible; dispatcherTimer.Start(); } if (e.Key == Key.S) { Settings settings = new Settings(); settings.Show(); this.Close(); } if (e.Key == Key.G) { TV_Guide tvg = new TV_Guide(); tvg.Show(); this.Close(); } if (e.Key == Key.OemQuestion) { Settings setting = new Settings(); setting.Show(); this.Close(); } if (Notification_popup0.Visibility == Visibility.Visible) { if (e.Key == Key.O) { LiveTV liveTV = new LiveTV(2); liveTV.Show(); this.Close(); } } else { if (e.Key == Key.O) { content[selectedIndex, 0] = "Settings"; content[selectedIndex, 1] = "Image/settings_icon.png"; /* amazon prime page*/ Amazon pr = new Amazon(); pr.Show(); this.Close(); } } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Back) { MainWindow home = new MainWindow(); home.Show(); MainStack.Children.Clear(); notifyButtonList.Clear(); //notificationContents.Clear(); this.Close(); } else if (e.Key == Key.Z) { resetButtons(); } else if (e.Key == Key.Down) { buttonInd += 1 % notificationContents.Count; } else if (e.Key == Key.Up) { if (buttonInd == 0) { buttonInd = notificationContents.Count - 1; } else { buttonInd -= 1 % notificationContents.Count; } } else if (e.Key == Key.O) { LiveTV li = new LiveTV(3); li.Show(); this.Close(); } else if (e.Key == Key.H) { MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } else if (e.Key == Key.S) { Settings settings = new Settings(); settings.Show(); this.Close(); } else if (e.Key == Key.G) { TV_Guide tvg = new TV_Guide(); tvg.Show(); this.Close(); } else if (e.Key == Key.OemQuestion) { Settings setting = new Settings(); setting.Show(); this.Close(); } }
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; } }