コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: robwil/VerseMemory
        /**
         * Key handler.
         * Since this app is primarily keyboard-focused, this is where the mapping of user interaction to logic happens.
         **/
        private void OnKeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                SwapVisibilities();
                if (showingAnswer == false)
                    AdvanceSlide();
            }
            else if (e.Key == Key.N)
            {
                NewSlideWindow w = new NewSlideWindow(this);
                w.ShowDialog();
                HandleNewSlides();
            }
            else if (e.Key == Key.I)
            {
                ImportFile();
            }
            else if (e.Key == Key.M)
            {
                ToggleMemorized();
            }
            else if (e.Key == Key.R)
            {
                ResetDecks();
            }
            else if (e.Key == Key.Up)
            {
                currentSlide.weight++;
                deck.SortAll();
            }
            else if (e.Key == Key.Down)
            {
                currentSlide.weight--;
                deck.SortAll();
            }
            else if (e.Key == Key.D)
            {
                DeleteCurrentSlide();
            }
            else if (e.Key == Key.H)
            {
                HelpWindow w = new HelpWindow();
                w.ShowDialog();
            }
            else if (e.Key == Key.E)
            {
                EditSlideWindow w = new EditSlideWindow(currentSlide);
                w.ShowDialog();
                UpdateScreenText();
            }
            else if (e.Key == Key.V)
            {
                List<Slide> currentDeckSlides;
                if (deck.notMemorizedSlides.Count > 0)
                    currentDeckSlides = deck.notMemorizedSlides;
                else if (deck.remainingSlides.Count > 0)
                    currentDeckSlides = deck.remainingSlides;
                else
                    currentDeckSlides = deck.finishedSlides;

                DeckViewWindow w = new DeckViewWindow(currentDeckSlides);
                w.ShowDialog();
            }
            else if (e.Key == Key.Escape)
            {
                Close();
            }
            UpdateScreenText();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: robwil/VerseMemory
        /**
         * Key handler.
         * Since this app is primarily keyboard-focused, this is where the mapping of user interaction to logic happens.
         **/
        private void OnKeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                SwapVisibilities();
                if (showingAnswer == false)
                {
                    AdvanceSlide();
                }
            }
            else if (e.Key == Key.N)
            {
                NewSlideWindow w = new NewSlideWindow(this);
                w.ShowDialog();
                HandleNewSlides();
            }
            else if (e.Key == Key.I)
            {
                ImportFile();
            }
            else if (e.Key == Key.M)
            {
                ToggleMemorized();
            }
            else if (e.Key == Key.R)
            {
                ResetDecks();
            }
            else if (e.Key == Key.Up)
            {
                currentSlide.weight++;
                deck.SortAll();
            }
            else if (e.Key == Key.Down)
            {
                currentSlide.weight--;
                deck.SortAll();
            }
            else if (e.Key == Key.D)
            {
                DeleteCurrentSlide();
            }
            else if (e.Key == Key.H)
            {
                HelpWindow w = new HelpWindow();
                w.ShowDialog();
            }
            else if (e.Key == Key.E)
            {
                EditSlideWindow w = new EditSlideWindow(currentSlide);
                w.ShowDialog();
                UpdateScreenText();
            }
            else if (e.Key == Key.V)
            {
                List <Slide> currentDeckSlides;
                if (deck.notMemorizedSlides.Count > 0)
                {
                    currentDeckSlides = deck.notMemorizedSlides;
                }
                else if (deck.remainingSlides.Count > 0)
                {
                    currentDeckSlides = deck.remainingSlides;
                }
                else
                {
                    currentDeckSlides = deck.finishedSlides;
                }

                DeckViewWindow w = new DeckViewWindow(currentDeckSlides);
                w.ShowDialog();
            }
            else if (e.Key == Key.Escape)
            {
                Close();
            }
            UpdateScreenText();
        }