1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
   |  
 
 private void SettingsScreen_TouchDown(object sender, TouchEventArgs e)// gestion evenement de la couche tactile
        {
 
            int x, y;
            e.GetPosition((Clavier)sender, 0, out x, out y);
 
            for (int i = 0; i < tabButtons.Length; i++)
            {
                if (x >= tabButtons[i].X && x <= tabButtons[i].X + tabButtons[i].Width &&
                    y >= tabButtons[i].Y && y <= tabButtons[i].Y + tabButtons[i].Height)
                {
                    if (tabButtons[i].State == ActionButton.STATE_NORMAL)
                    {    
                            tabButtons[buttonIndex].Blur();
 
                        tabButtons[i].State = ActionButton.STATE_FOCUSED;
                    }
 
                    buttonIndex = i;
                    BlurAll();
                    DrawSettings();
 
                    if (tabButtons[i].State == ActionButton.STATE_FOCUSED)
                    {
                        //  action sur bouton
                        switch (buttonIndex)
                        {
                        //  bouton 0
                            case 0:
                                if (tabButtons[0].IsEnabled)
                                {
                                    code = "0";
                                }
                                break;
 
                            //  bouton 1
                            case 1:
                                if (tabButtons[1].IsEnabled)
 
                                   code = "1";
                                break;
 
                                // buttons 2
                             case 2:
                                if (tabButtons[2].IsEnabled)
                                {
                                    code = "2";
                                }
                                break;
                                  ......// les autres boutons
 
                            //bouton valider
                            case 10:
                                if (tabButtons[10].IsEnabled)
                                {
                                    if (code2 == "0123")
                                    {
                                        code = null;
                                        code2 = null;
                                        screen.DrawText("", ninaBFont, Colors.Red, 125, 40);
                                        screen.DrawText("ok", ninaBFont, Colors.Orange, 150, 40);
                                    }
                                    else
                                    {
                                        code = null;
                                        code2 = null;
                                        screen.DrawText("", ninaBFont, Colors.Red, 125, 40);
                                        screen.DrawText("Incorrect", ninaBFont, Colors.Red, 125, 40);
                                    }
                                }
                                break;
 
                        }
                    }
                    break;
                }
            }
            code2 = code2 + code;// code finale
            screen.DrawText(code2, ninaBFont, Colors.Green, 120, 40);
            screen.Flush();
        } |