コード例 #1
0
        protected override void CustomUpdateInput(ConsoleKey key)
        {
            if (key == ConsoleKey.P)
            {
                var prompt = new PromptOverlay(this, "Write here")
                {
                    ForegroundColor = ConsoleColor.White, BackgroundColor = ConsoleColor.Black
                };
                prompt.Open();
                return;
            }

            if (menu.UpdateInput(key))
            {
                Invalidate(false);
            }
            else
            {
                var isLetter = key >= ConsoleKey.A && key <= ConsoleKey.Z;
                var isNumber = key >= ConsoleKey.D1 && key <= ConsoleKey.D0;
                if (isLetter || isNumber || key == ConsoleKey.Spacebar)
                {
                    Invalidate(true);
                }
            }
        }
コード例 #2
0
        private void MenuOnInstanceItemSelected(object sender, string id)
        {
            switch (id)
            {
            case "Back":
                ChangeScreen(ScreenName.MainMenu);
                break;

            case "Songs":
                var overlay = new SongBrowserOverlay(this, jukeControl.Browser.Songs);
                overlay.SongSelected += (o, songTitle) => PlaySong(songTitle);
                overlay.Open();
                break;

            case "Save":
                var prompt = new PromptOverlay(this, "Choose filename");
                prompt.TextEntered += SaveFileSelected;
                prompt.Open();
                break;

            case "Load":
                var loadPrompt = new PromptOverlay(this, "Choose filename");
                loadPrompt.TextEntered += LoadPromptOnTextEntered;
                loadPrompt.Open();
                break;
            }
        }