diff --git a/T9KeyboardApp/Form1.Designer.cs b/T9KeyboardApp/Form1.Designer.cs index ced4cbe..b7aae74 100644 --- a/T9KeyboardApp/Form1.Designer.cs +++ b/T9KeyboardApp/Form1.Designer.cs @@ -47,10 +47,15 @@ private void InitializeComponent() button14 = new Button(); button15 = new Button(); button16 = new Button(); + lblEntryMode = new Label(); + label1 = new Label(); + lblActiveChar = new Label(); SuspendLayout(); // // textBox1 // + textBox1.AccessibleDescription = "Textfeld"; + textBox1.AccessibleName = " "; textBox1.BackColor = SystemColors.ControlLight; textBox1.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); textBox1.Location = new Point(463, 16); @@ -67,6 +72,8 @@ private void InitializeComponent() // // button1 // + button1.AccessibleDescription = "Taste 1"; + button1.AccessibleName = "1, Leerzeichen, Anführungzeichen"; button1.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button1.Location = new Point(-1, 125); button1.Margin = new Padding(4, 5, 4, 5); @@ -79,6 +86,8 @@ private void InitializeComponent() // // button2 // + button2.AccessibleDescription = "Taste 2"; + button2.AccessibleName = "2, A, B, oder C"; button2.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button2.Location = new Point(124, 125); button2.Margin = new Padding(4, 5, 4, 5); @@ -91,6 +100,8 @@ private void InitializeComponent() // // button3 // + button3.AccessibleDescription = "Taste 3"; + button3.AccessibleName = "3, D, E, F"; button3.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button3.Location = new Point(249, 125); button3.Margin = new Padding(4, 5, 4, 5); @@ -103,6 +114,8 @@ private void InitializeComponent() // // button4 // + button4.AccessibleDescription = "Taste 4"; + button4.AccessibleName = "4, G, H, I"; button4.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button4.Location = new Point(-1, 245); button4.Margin = new Padding(4, 5, 4, 5); @@ -115,6 +128,8 @@ private void InitializeComponent() // // button5 // + button5.AccessibleDescription = "Taste 5"; + button5.AccessibleName = "5, J, K, L"; button5.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button5.Location = new Point(124, 245); button5.Margin = new Padding(4, 5, 4, 5); @@ -127,6 +142,8 @@ private void InitializeComponent() // // button6 // + button6.AccessibleDescription = "Taste 6"; + button6.AccessibleName = "6, M, N, O"; button6.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button6.Location = new Point(249, 245); button6.Margin = new Padding(4, 5, 4, 5); @@ -139,6 +156,8 @@ private void InitializeComponent() // // button7 // + button7.AccessibleDescription = "Taste 7"; + button7.AccessibleName = "7, P, Q, R, S"; button7.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button7.Location = new Point(-1, 365); button7.Margin = new Padding(4, 5, 4, 5); @@ -151,6 +170,8 @@ private void InitializeComponent() // // button8 // + button8.AccessibleDescription = "Taste 8"; + button8.AccessibleName = "8, T, U, V"; button8.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button8.Location = new Point(124, 365); button8.Margin = new Padding(4, 5, 4, 5); @@ -163,6 +184,8 @@ private void InitializeComponent() // // button9 // + button9.AccessibleDescription = "Taste 9"; + button9.AccessibleName = "9, W, X, Y, Z"; button9.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button9.Location = new Point(249, 365); button9.Margin = new Padding(4, 5, 4, 5); @@ -175,6 +198,8 @@ private void InitializeComponent() // // button10 // + button10.AccessibleDescription = "Taste Null"; + button10.AccessibleName = "Null, At-Zeichen, Grad, Prozent"; button10.Font = new Font("Microsoft Sans Serif", 13.8F, FontStyle.Regular, GraphicsUnit.Point); button10.Location = new Point(124, 489); button10.Margin = new Padding(4, 5, 4, 5); @@ -192,6 +217,8 @@ private void InitializeComponent() // // buttonModeSwitch // + buttonModeSwitch.AccessibleDescription = "Rautetaste"; + buttonModeSwitch.AccessibleName = "Rautetaste, Umschalten, Feststellen, Zifferneingabe"; buttonModeSwitch.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonModeSwitch.Location = new Point(249, 489); buttonModeSwitch.Margin = new Padding(4, 5, 4, 5); @@ -200,10 +227,12 @@ private void InitializeComponent() buttonModeSwitch.TabIndex = 11; buttonModeSwitch.Text = "#\r\nAa123"; buttonModeSwitch.UseVisualStyleBackColor = true; - buttonModeSwitch.Click += buttonModeSwitch_Click; + buttonModeSwitch.Click += ButtonModeSwitch_Click; // // button12 // + button12.AccessibleDescription = "Plustaste"; + button12.AccessibleName = "Plus, kaufmännisches Und"; button12.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button12.Location = new Point(374, 365); button12.Margin = new Padding(4, 5, 4, 5); @@ -216,6 +245,8 @@ private void InitializeComponent() // // button13 // + button13.AccessibleDescription = "Minustaste"; + button13.AccessibleName = "Minus, Unterstrich, Gleich"; button13.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button13.Location = new Point(374, 245); button13.Margin = new Padding(4, 5, 4, 5); @@ -228,6 +259,8 @@ private void InitializeComponent() // // button14 // + button14.AccessibleDescription = "Taste Stern"; + button14.AccessibleName = "Stern, Dachel"; button14.Font = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular, GraphicsUnit.Point); button14.Location = new Point(-1, 489); button14.Margin = new Padding(4, 5, 4, 5); @@ -240,6 +273,8 @@ private void InitializeComponent() // // button15 // + button15.AccessibleDescription = "Taste Geteilt"; + button15.AccessibleName = "Schrägstrich, Backslash, senkrechter Strich"; button15.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point); button15.Location = new Point(374, 125); button15.Margin = new Padding(4, 5, 4, 5); @@ -252,6 +287,8 @@ private void InitializeComponent() // // button16 // + button16.AccessibleDescription = "Kommataste"; + button16.AccessibleName = "Komma, Punkt, Ausrufezeichen, Fragezeichen, Doppelpunkt, Semikolon"; button16.Font = new Font("Microsoft Sans Serif", 24F, FontStyle.Regular, GraphicsUnit.Point); button16.Location = new Point(374, 490); button16.Margin = new Padding(4, 5, 4, 5); @@ -262,11 +299,47 @@ private void InitializeComponent() button16.UseVisualStyleBackColor = true; button16.Click += ButtonClick; // + // lblEntryMode + // + lblEntryMode.BackColor = SystemColors.ControlLightLight; + lblEntryMode.BorderStyle = BorderStyle.FixedSingle; + lblEntryMode.Font = new Font("Cambria", 10.8F, FontStyle.Bold, GraphicsUnit.Point); + lblEntryMode.Location = new Point(249, 25); + lblEntryMode.Name = "lblEntryMode"; + lblEntryMode.Size = new Size(117, 36); + lblEntryMode.TabIndex = 17; + lblEntryMode.Text = "Abc"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(193, 25); + label1.Name = "label1"; + label1.Size = new Size(48, 20); + label1.TabIndex = 18; + label1.Text = "Mode"; + // + // lblActiveChar + // + lblActiveChar.BackColor = Color.AntiqueWhite; + lblActiveChar.BorderStyle = BorderStyle.FixedSingle; + lblActiveChar.Font = new Font("Cambria", 10.8F, FontStyle.Bold, GraphicsUnit.Point); + lblActiveChar.Location = new Point(374, 25); + lblActiveChar.Name = "lblActiveChar"; + lblActiveChar.Size = new Size(69, 36); + lblActiveChar.TabIndex = 19; + lblActiveChar.Text = "x"; + // // Form1 // + AccessibleDescription = "T9 Tastatur. Geben Sie Text mit der Nummerntastatur ein, ungefähr wie auf alten Handys."; + AccessibleName = "T9 Tastatur"; AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1230, 629); + Controls.Add(lblActiveChar); + Controls.Add(label1); + Controls.Add(lblEntryMode); Controls.Add(button16); Controls.Add(button15); Controls.Add(button14); @@ -313,6 +386,9 @@ private void InitializeComponent() private Button button14; private Button button15; private Button button16; + private Label lblEntryMode; + private Label label1; + private Label lblActiveChar; } } diff --git a/T9KeyboardApp/Form1.cs b/T9KeyboardApp/Form1.cs index c8884da..481dfb3 100644 --- a/T9KeyboardApp/Form1.cs +++ b/T9KeyboardApp/Form1.cs @@ -13,6 +13,7 @@ public Form1() { InitializeComponent(); EntryMode = Mode.Normal; + DisplayEntryMode(); } private void Button1_Click(object sender, EventArgs e) @@ -20,7 +21,7 @@ private void Button1_Click(object sender, EventArgs e) textBox1.Text += " "; } -#region keyhandler + #region keyhandler private void Form1_KeyDown(object sender, KeyEventArgs e) { ; @@ -68,7 +69,7 @@ private void Form1_KeyUp(object sender, KeyEventArgs e) textBox1.Text = textBox1.Text.Backspace(); } } -#endregion + #endregion private void TypeLetter() { char? c = buttonPressed?.Text[0]; @@ -82,25 +83,28 @@ private void TypeLetter() if (EntryMode == Mode.Capital) { EntryMode = Mode.Normal; + DisplayEntryMode(); } } private void ButtonClick(object sender, EventArgs e) { - //((Button)sender).BackColor = Color.White; if (buttonPressed != sender as Button) { if (timerIsRunning) StopTimer(); StartTimer(); } - if (!timerIsRunning) + if (!timerIsRunning && EntryMode != Mode.Numeric) { StartTimer(); } buttonPressed = sender as Button; if (int.TryParse("" + buttonPressed?.Text[0], out int index)) + { Buttons.buttons[index].Hit(); + lblActiveChar.Text = "" + Buttons.buttons[index].Value(); + } else OperatorButton(buttonPressed?.Text[0]); textBox1.Select(); @@ -180,7 +184,7 @@ private void StopTimer() } - private void buttonModeSwitch_Click(object sender, EventArgs e) + private void ButtonModeSwitch_Click(object sender, EventArgs e) { SwitchMode(); textBox1.Select(); @@ -189,7 +193,9 @@ private void buttonModeSwitch_Click(object sender, EventArgs e) private void SwitchMode() { EntryMode = (Mode)((int)(EntryMode + 1) % 4); - //colors + DisplayEntryMode(); } + + private void DisplayEntryMode() => lblEntryMode.Text = Params.EntryModes[(int)EntryMode]; } } diff --git a/T9KeyboardApp/Utils.cs b/T9KeyboardApp/Utils.cs index 6a63870..257a994 100644 --- a/T9KeyboardApp/Utils.cs +++ b/T9KeyboardApp/Utils.cs @@ -113,4 +113,11 @@ public static class Buttons }; } + + public static class Params + { + public static readonly String[] EntryModes = { + "abc", "Abc", "ABC", "123" + }; + } }