예제 #1
0
        private void ImageButton_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right && (ButtonIndex + 1) % 4 != 0)
            {
                ButtonIndex += 1;
            }
            else if (e.Key == Key.Right && (ButtonIndex + 1) % 4 == 0)
            {
                for (int i = 0; i < ButtonsForImages.Count; i++)
                {
                    ButtonsForImages[i].Focusable = false;
                }
                Sort_Button.Focus();
            }
            else if (e.Key == Key.Left && (ButtonIndex) % 4 != 0)
            {
                ButtonIndex -= 1;
            }
            else if (e.Key == Key.Down && (ButtonIndex + 4 < ButtonsForImages.Count))
            {
                ButtonIndex += 4;
            }
            else if (e.Key == Key.Down && (ButtonIndex + 4 > ButtonsForImages.Count))
            {
                ButtonIndex = ButtonIndex % 4;
            }
            else if (e.Key == Key.Up && (ButtonIndex - 4) >= 0)
            {
                ButtonIndex -= 4;
            }

            else if (e.Key == Key.Up && (ButtonIndex) < 4)
            {
                ButtonIndex += 4;
            }

            else if (e.Key == Key.Back && !viewingEnlargaredImages)
            {
                MainWindow home = new MainWindow();
                home.Show();
                this.Close();
            }
            else if (e.Key == Key.O)
            {
                EnlargePhotoScreen();
            }

            Console.WriteLine("ButtonIndex: " + ButtonIndex);
        }
예제 #2
0
        private void Yes_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.O)
            {
                //char a = MusicButtonsGrids[MusicIndex].Name[10];
                //String searchFor = "SongNameTb" + a;
                //String songName = ((TextBlock)MusicButtonsGrids[MusicIndex].FindName(searchFor)).Text;
                //MusicDeleteMessage.Content = songName + " has been deleted.";
                //Notification_popup0.Visibility = Visibility.Visible; dispatcherTimer.Start();
                char   a         = RecordButtonsGrids[RecordIndex].Name[10];
                String searchFor = "RecordName" + a;
                //Console.WriteLine("Search for: " + a);
                String recordName = ((TextBlock)RecordButtonsGrids[RecordIndex].FindName(searchFor)).Text;
                RecordingsDeleteMessage.Content = recordName + " has been deleted.";
                //MusicIndex -= 1;
                Notification_popup0.Visibility = Visibility.Visible; dispatcherTimerNotification.Start();
                RecordingList.Effect           = null;
                Sort_Button.Effect             = null;
                DeleteMultiple_Button.Effect   = null;
                Add_Button.Effect = null;

                for (int i = 0; i < RecordButtonsList.Count; i++)
                {
                    RecordButtonsList[i].Focusable = true;
                }
                DeleteMessage.Visibility = Visibility.Hidden;
                //MusicGrid.Effect = null;
                RecordingList.Children.Remove(RecordButtonsList[RecordIndex]);
                RecordButtonsList.RemoveAt(RecordIndex);
                RecordButtonsGrids.RemoveAt(RecordIndex);
                for (int i = 0; i < RecordButtonsGrids.Count; i++)
                {
                    Console.WriteLine(RecordButtonsList[i].Name);
                }

                //Console.WriteLine("Remove :" + MusicIndex);



                //Keyboard.ClearFocus();
                if (RecordIndex == RecordButtonsList.Count && RecordButtonsList.Count != 0)
                {
                    RecordIndex         -= 1;
                    showRecordingButtons = false;

                    RecordButtonsList[RecordIndex].Focus();
                }
                else if (RecordButtonsList.Count != 0)
                {
                    showRecordingButtons = false;

                    RecordButtonsList[RecordIndex].Focus();
                }
                else
                {
                    Sort_Button.Focusable           = true;
                    DeleteMultiple_Button.Focusable = true;
                    Sort_Button.Focus();
                }
            }
        }
예제 #3
0
        private void Delete_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Down)
            {
                if (RecordIndex < RecordButtonsList.Count - 1)
                {
                    RecordIndex += 1;
                    Console.WriteLine("RecordIndex: " + RecordIndex);
                }
                else
                {
                    RecordIndex = 0;
                    Console.WriteLine("RecordIndex: " + RecordIndex);
                }
                showRecordingButtons = false;
            }
            else if (e.Key == Key.Up)
            {
                if (RecordIndex != 0)
                {
                    RecordIndex -= 1;
                    Console.WriteLine("RecordIndex: " + RecordIndex);
                }
                else
                {
                    RecordIndex = RecordButtonsList.Count - 1;
                    Console.WriteLine("RecordIndex: " + RecordIndex);
                }
                showRecordingButtons = false;
            }
            else if (e.Key == Key.Right)
            {
                RecordButtonsList[RecordIndex].Height  = 60;
                RecordButtonsGrids[RecordIndex].Height = 60;
                for (int i = 0; i < RecordButtonsList.Count; i++)
                {
                    RecordButtonsList[i].Focusable = false;
                }
                //Keyboard.ClearFocus();
                play.Focusable   = false;
                delete.Focusable = false;
                RecordButtonsGrids[RecordIndex].Children.Remove(play);
                RecordButtonsGrids[RecordIndex].Children.Remove(delete);
                Sort_Button.Focusable           = true;
                DeleteMultiple_Button.Focusable = true;
                Sort_Button.Focus();
            }
            else if (e.Key == Key.O)
            {
                DeleteMessage.Visibility = Visibility.Visible;
                //MusicGrid.Effect = new BlurEffect();
                RecordingList.Effect         = new BlurEffect();
                Sort_Button.Effect           = new BlurEffect();
                DeleteMultiple_Button.Effect = new BlurEffect();
                Add_Button.Effect            = new BlurEffect();
                //MusicDuration.Effect = new BlurEffect();
                //DeleteMessage.Effect = null;
                //MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);



                TextBlock DeleteMessageTb = new TextBlock();
                DeleteMessageTb.Text = "Would you like to delete the following Song:";
                Grid.SetRow(DeleteMessageTb, 0);
                Grid.SetColumn(DeleteMessageTb, 0);
                Grid.SetColumnSpan(DeleteMessageTb, 2);
                DeleteMessageTb.VerticalAlignment   = VerticalAlignment.Center;
                DeleteMessageTb.HorizontalAlignment = HorizontalAlignment.Center;
                DeleteMessageTb.FontFamily          = new FontFamily("Segoe UI Black");
                DeleteMessageTb.FontSize            = 16;


                char   a         = RecordButtonsGrids[RecordIndex].Name[10];
                String searchFor = "RecordName" + a;
                //Console.WriteLine("Search for: " + a);
                String recordName = ((TextBlock)RecordButtonsGrids[RecordIndex].FindName(searchFor)).Text;
                //MusicIndex -= 1;

                TextBlock DeleteSongTb = new TextBlock();
                DeleteSongTb.Text = recordName;

                //TextBlock DeleteSongTb = new TextBlock();
                Grid.SetRow(DeleteSongTb, 1);
                Grid.SetColumn(DeleteSongTb, 0);
                Grid.SetColumnSpan(DeleteSongTb, 2);
                DeleteSongTb.VerticalAlignment   = VerticalAlignment.Center;
                DeleteSongTb.HorizontalAlignment = HorizontalAlignment.Center;
                DeleteSongTb.FontSize            = 14;

                Button yes = new Button();
                yes.Width      = 50;
                yes.Content    = "Yes";
                yes.GotFocus  += Yes_GotFocus;
                yes.LostFocus += Button_LostFocus;
                yes.KeyDown   += Yes_KeyDown;
                Grid.SetRow(yes, 2);
                Grid.SetColumn(yes, 0);
                yes.VerticalAlignment   = VerticalAlignment.Center;
                yes.HorizontalAlignment = HorizontalAlignment.Center;
                yes.Style = (Style)FindResource("StandardButton");

                Button no = new Button();
                no.Width      = 50;
                no.Content    = "No";
                no.GotFocus  += Button_GotFocus;
                no.LostFocus += Button_LostFocus;
                no.KeyDown   += No_KeyDown;
                Grid.SetRow(no, 2);
                Grid.SetColumn(no, 1);
                no.VerticalAlignment   = VerticalAlignment.Center;
                no.HorizontalAlignment = HorizontalAlignment.Center;
                no.Style = (Style)FindResource("StandardButton");



                DeleteMessage.Children.Clear();
                DeleteMessage.Children.Add(DeleteMessageTb);
                DeleteMessage.Children.Add(DeleteSongTb);
                DeleteMessage.Children.Add(yes);
                DeleteMessage.Children.Add(no);

                for (int i = 0; i < RecordButtonsList.Count; i++)
                {
                    RecordButtonsList[i].Focusable = false;
                }

                Keyboard.ClearFocus();
                RecordButtonsGrids[RecordIndex].Children.Remove(play);
                RecordButtonsGrids[RecordIndex].Children.Remove(delete);
                RecordButtonsGrids[RecordIndex].Height = 50;
                RecordButtonsList[RecordIndex].Height  = 50;
                yes.Focus();
                //Popup a = new Popup();
                Console.WriteLine("Delete Entered on");
            }
            else if (e.Key == Key.Back)
            {
                MainWindow home = new MainWindow();
                home.Show();
                this.Close();
            }
        }