コード例 #1
0
        public void PressKey(char c)
        {
            _session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
            switch (c)
            {
            case '0': ZeroBtn.Click(); break;

            case '1': OneBtn.Click(); break;

            case '2': TwoBtn.Click(); break;

            case '3': ThreeBtn.Click(); break;

            case '4': FourBtn.Click(); break;

            case '5': FiveBtn.Click(); break;

            case '6': SixBtn.Click(); break;

            case '7': SevenBtn.Click(); break;

            case '8': EightBtn.Click(); break;

            case '9': NineBtn.Click(); break;

            case '.': DecimalBtn.Click(); break;

            case '+': AdditionBtn.Click(); break;

            case '-': SubtractBtn.Click(); break;

            case '/': DivideBtn.Click(); break;

            case '*': MultiplyBtn.Click(); break;

            case '%': PercentBtn.Click(); break;

            case '(': LeftParenthesisBtn.Click(); break;

            case ')': RightParenthesisBtn.Click(); break;

            default: throw new NotSupportedException($"Charactor: {c} not supported");
            }
        }
コード例 #2
0
        public void PressKey(char c)
        {
            switch (c)
            {
            case '0': ZeroBtn.Click(); break;

            case '1': OneBtn.Click(); break;

            case '2': TwoBtn.Click(); break;

            case '3': ThreeBtn.Click(); break;

            case '4': FourBtn.Click(); break;

            case '5': FiveBtn.Click(); break;

            case '6': SixBtn.Click(); break;

            case '7': SevenBtn.Click(); break;

            case '8': EightBtn.Click(); break;

            case '9': NineBtn.Click(); break;

            case '+': AdditionBtn.Click(); break;

            case '-': SubtractBtn.Click(); break;

            case '/': DivideBtn.Click(); break;

            case '*': MultiplyBtn.Click(); break;

            case '%': PercentBtn.Click(); break;

            case '(': LeftParenthesisBtn.Click(); break;

            case ')': RightParenthesisBtn.Click(); break;

            default: throw new NotSupportedException($"Charactor: {c} not supported");
            }
        }
コード例 #3
0
        private void PressKey(char c)
        {
            switch (c)
            {
            case '0': ZeroBtn.Click(); break;

            case '1': OneBtn.Click(); break;

            case '2': TwoBtn.Click(); break;

            case '3': ThreeBtn.Click(); break;

            case '4': FourBtn.Click(); break;

            case '5': FiveBtn.Click(); break;

            case '6': SixBtn.Click(); break;

            case '7': SevenBtn.Click(); break;

            case '8': EightBtn.Click(); break;

            case '9': NineBtn.Click(); break;

            case '.': DecimalBtn.Click(); break;

            case '+': AdditionBtn.Click(); break;

            case '-': SubtractBtn.Click(); break;

            case '/': DivideBtn.Click(); break;

            case '*': MultiplyBtn.Click(); break;

            case '%': PercentBtn.Click(); break;

            default: Console.WriteLine($"Charactor: {c} not supported"); break;
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: Jasphur/SimpleCalculator
        // Zorgen dat het toetsenbord gebruikt kan worden
        private void NumPadInput(object sender, KeyPressEventArgs e)
        {
            switch (e.KeyChar.ToString())
            {
            case "0":
                ZeroBtn.PerformClick();
                break;

            case "1":
                OneBtn.PerformClick();
                break;

            case "2":
                TwoBtn.PerformClick();
                break;

            case "3":
                ThreeBtn.PerformClick();
                break;

            case "4":
                FourBtn.PerformClick();
                break;

            case "5":
                FiveBtn.PerformClick();
                break;

            case "6":
                SixBtn.PerformClick();
                break;

            case "7":
                SevenBtn.PerformClick();
                break;

            case "8":
                EightBtn.PerformClick();
                break;

            case "9":
                NineBtn.PerformClick();
                break;

            case "*":
                TimesBtn.PerformClick();
                break;

            case "/":
                DivideBtn.PerformClick();
                break;

            case "-":
                SubtractBtn.PerformClick();
                break;

            case "+":
                Addbtn.PerformClick();
                break;

            case ",":
                DecimalBtn.PerformClick();
                break;

            case ".":
                DecimalBtn.PerformClick();
                break;

            case "c":
                ClearBtn.PerformClick();
                break;

            // Twee keer op de "c" toets op het toetsenbord klikken voor een All Clear
            case "c" + "c":
                AllClearBtn.PerformClick();
                break;

            default:
                break;
            }

            // De "Enter" toets op het toetsenbord de functie van de "=" toets toewijzen
            if (e.KeyChar == (char)Keys.Enter)
            {
                EqualBtn.PerformClick();
            }
        }