Ejemplo n.º 1
0
        void keyboardIcona_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            button.TurnLedOn();
            button.ButtonPressed += button_ButtonPressed;
            HideButtons();
            displayTE35.SimpleGraphics.DisplayImage(istrKey, 0, 0);
            Thread.Sleep(2000);
            canvas.Children.Clear();
            canvas.Children.Add(numericKey);
            canvas.Children.Add(username);
            Canvas.SetBottom(username, 15);
            Canvas.SetLeft(username, 0);
            canvas.Children.Add(usernameValue);
            Canvas.SetBottom(usernameValue, 15);
            Canvas.SetLeft(usernameValue, 80);


            canvas.Children.Add(pin);
            Canvas.SetBottom(pin, 15);
            Canvas.SetLeft(pin, 200);
            canvas.Children.Add(pinValue);
            Canvas.SetBottom(pinValue, 15);
            Canvas.SetLeft(pinValue, 235);

            numericKey.TouchDown += numericKey_TouchDown;
        }
Ejemplo n.º 2
0
        /**
         * Define el evento touch de la pantalla
         */
        void TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            //proceso();
            Debug.Print("TouchDown!!");



/*
 *          POSTContent post_content;
 *          String twitter_url;
 *          String post_string;
 *
 *          twitter_url = "http://www.google.cl";
 *          post_string = "";
 *          //post_content = POSTContent.CreateTextBasedContent(post_string);
 *          post_content = new POSTContent();
 *
 *          //HttpRequest request = HttpHelper.CreateHttpPostRequest(twitter_url, post_content, null);
 *          HttpRequest request = HttpHelper.CreateHttpGetRequest(twitter_url);
 *
 *          request.ResponseReceived += new HttpRequest.ResponseHandler(ResponseReceived);
 *          //request.AddHeaderField("", "");
 *          request.SendRequest();
 */
        }
Ejemplo n.º 3
0
        void sdcard_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            button.TurnLedOn();
            button.ButtonPressed += button_ButtonPressed;
            HideButtons();
            displayTE35.SimpleGraphics.DisplayImage(istruzioniSD, 0, 0);
            Thread.Sleep(5000);
            if (sdCard.IsCardInserted && sdCard.IsCardMounted)
            {
                button.ButtonPressed -= button_ButtonPressed;
                button.TurnLedOff();
                HideButtons();
                displayTE35.SimpleGraphics.DisplayImage(authTry, 0, 0);
                string rootdirectory = sdCard.StorageDevice.RootDirectory;
                rootdirectory += @"\accessDoor";
                FileStream fileStream = new FileStream(rootdirectory + @"\authDoor.txt", FileMode.Open);
                byte[]     data       = new byte[fileStream.Length];
                Debug.Print(fileStream.Length + "");
                fileStream.Read(data, 0, data.Length);
                fileStream.Close();
                Debug.Print("data: " + data);
                string text = new string(Encoding.UTF8.GetChars(data));
                Debug.Print("text: " + text);
                userStr = text.Substring(0, 6);
                Debug.Print(userStr);
                pinStr = text.Substring(8, 4);
                Debug.Print(pinStr);


                button.ButtonPressed -= button_ButtonPressed;
                Debug.Print("Contatta server");


                utenteCorrente.id   = userStr.ToString();
                utenteCorrente.user = userStr.ToString();
                utenteCorrente.pin  = pinStr.ToString();

                //Debug.Print("Net AVAIL: " + netif.NetworkIsAvailable);
                //Debug.Print("IP ADD: "+netif.IPAddress);
                //Debug.Print("DHCP EN: " + netif.IsDhcpEnabled);
                //Debug.Print("SUBNET MASK:" + netif.SubnetMask);
                //Debug.Print("GATEWAY" + netif.GatewayAddress);
                //Debug.Print("PIN "+ pinStr.ToString());
                Hashtable ht = new Hashtable();
                ht.Add("Id", utenteCorrente.id);
                ht.Add("User", utenteCorrente.user);
                ht.Add("Pwd", utenteCorrente.pin);

                POSTContent content = Gadgeteer.Networking.POSTContent.CreateWebFormData(ht);
                var         request = HttpHelper.CreateHttpPostRequest(@"http://169.254.202.73/api/Utente/", content, "application/x-www-form-urlencoded");
                request.ResponseReceived += request_ResponseReceived_USER_PIN;

                request.SendRequest();
                HideButtons();
            }

            SetupDisplay();
        }
Ejemplo n.º 4
0
 void mainWindow_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     intervalPosition++;
     if (intervalPosition == intervals.Length)
     {
         intervalPosition = 0;
     }
     setTimerInterval(intervalPosition);
 }
Ejemplo n.º 5
0
 void display_Standby_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     if (displayTE35.BacklightEnabled == false)
     {
         mainWindow.TouchDown        -= display_Standby_TouchDown;
         displayTE35.BacklightEnabled = true;
         SetupDisplay();
     }
 }
Ejemplo n.º 6
0
        void touchScreen_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            String str = "touch detected at: " + e.Touches[0].X + "x" + e.Touches[0].Y;

            Debug.Print(str);
            console.TextContent = str;
            timer.Start();
        }
Ejemplo n.º 7
0
 private void MainWindow_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     //lepas handler
     mainWindow.TouchDown -= MainWindow_TouchDown;
     //show info
     stackPanel.Children.Add(new Text(CurrentFont, "update is starting..."));
     stackPanel.Invalidate();
     //flash app
     FlashFirmware();
 }
Ejemplo n.º 8
0
        void increase_touch_hour_end(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            Int32 hour = Int32.Parse(initHourEnd.TextContent) + 1;

            if (hour % 24 >= 10)
            {
                initHourEnd.TextContent = hour % 24 + "";
            }
            else
            {
                initHourEnd.TextContent = "0" + hour % 24;
            }
        }
Ejemplo n.º 9
0
        void increase_touch_minute_end(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            Int32 minute = Int32.Parse(initMinuteEnd.TextContent) + 1;

            if (minute % 60 >= 10)
            {
                initMinuteEnd.TextContent = minute % 60 + "";
            }
            else
            {
                initMinuteEnd.TextContent = "0" + minute % 60;
            }
        }
Ejemplo n.º 10
0
 void decrease_touch_hour_end(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     if (Int32.Parse(initHourEnd.TextContent) == 0)
     {
         initHourEnd.TextContent = 23 + "";
     }
     else
     {
         Int32 hour = Int32.Parse(initHourEnd.TextContent) - 1;
         if (hour >= 10)
         {
             initHourEnd.TextContent = hour + "";
         }
     }
 }
Ejemplo n.º 11
0
        public void TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            pollingRatePosition++;
            if (pollingRatePosition >= pollingRates.Length)
            {
                pollingRatePosition = 0;
            }

            pollingTimer.Stop();
            pollingTimer.Interval = new TimeSpan(0, 0, 0, 0, pollingRates[pollingRatePosition]);

            if (!delayTimer.IsRunning)
            {
                delayTimer.Start();
            }
        }
Ejemplo n.º 12
0
        void mainWindow_TouchMove(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            TouchInput[] touches = e.Touches;
            int          oldX    = -1;
            int          oldY    = -1;

            foreach (TouchInput touch in touches)
            {
                int x = touch.X - sideBarWidth;
                int y = touch.Y;
                if (oldX != -1)
                {
                    background.Bitmap.DrawLine(drawingColor, 3, oldX, oldY, x, y);
                }
                oldX = x;
                oldY = y;
            }
            background.Invalidate();
        }
Ejemplo n.º 13
0
 void decrease_touch_minute_end(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     if (Int32.Parse(initMinuteEnd.TextContent) == 0)
     {
         initMinuteEnd.TextContent = 59 + "";
     }
     else
     {
         Int32 hour = Int32.Parse(initMinuteEnd.TextContent) - 1;
         if (hour >= 10)
         {
             initMinuteEnd.TextContent = hour + "";
         }
         else
         {
             initMinuteEnd.TextContent = "0" + hour;
         }
     }
 }
Ejemplo n.º 14
0
        void b_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            Border border = sender as Border;

            if (border == null)
            {
                return;
            }

            Text t = border.Child as Text;

            string content = t.TextContent;

            if (keyPressedHandler != null)
            {
                KeyPressedEventArgs args = new KeyPressedEventArgs(content);
                keyPressedHandler(sender, args);
            }
        }
Ejemplo n.º 15
0
        void getImage_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            timer.Stop();
            button.TurnLedOn();
            button.ButtonPressed += button_ButtonPressed;
            HideButtons();
            displayTE35.SimpleGraphics.DisplayImage(istruzioniFoto1, 0, 0);

            Thread.Sleep(3000);
            camera.CurrentPictureResolution = Camera.PictureResolution.Resolution320x240;

            if (camera.CameraReady)
            {
                camera.StartStreaming();
            }
            else if (!camera.CameraReady)
            {
                SetupDisplay();
            }
        }
Ejemplo n.º 16
0
 private void saveSettings(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     //Tipo di salvataggio ---> 11-00/23-50
     time_sett = inithour.TextContent + "-" + initminute.TextContent + "/" + initHourEnd.TextContent + "-" + initMinuteEnd.TextContent;
     setupWindow();
 }
Ejemplo n.º 17
0
 private void goBack(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     setupWindow();
 }
Ejemplo n.º 18
0
 void settings_navigator(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     setSetupWindow();
 }
Ejemplo n.º 19
0
 void yellowButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     drawingColor = GT.Color.Yellow;
 }
Ejemplo n.º 20
0
 void redButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     drawingColor = GT.Color.Red;
 }
Ejemplo n.º 21
0
 void greenButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     drawingColor = GT.Color.Green;
 }
Ejemplo n.º 22
0
 void whiteButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     drawingColor = GT.Color.White;
 }
Ejemplo n.º 23
0
        void numericKey_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
        {
            // cancella tutto con delete e con invio contatta il server
            int y, x;

            e.GetPosition(mainWindow, 0, out x, out y);
            char carattere = riconosci_tocco_tastiera(x, y);

            if (carattere == 'v')
            {
                return;
            }

            if (ntoccou == 10 && carattere != 'e')
            {
                return;
            }

            if (carattere == 'e' && ntoccou == 10)
            {
                button.ButtonPressed -= button_ButtonPressed;
                Debug.Print("Contatta server");

                utenteCorrente.id   = userStr.ToString();
                utenteCorrente.user = userStr.ToString();
                utenteCorrente.pin  = pinStr.ToString();

                //Debug.Print("Net AVAIL: " + netif.NetworkIsAvailable);
                //Debug.Print("IP ADD: "+netif.IPAddress);
                //Debug.Print("DHCP EN: " + netif.IsDhcpEnabled);
                //Debug.Print("SUBNET MASK:" + netif.SubnetMask);
                //Debug.Print("GATEWAY" + netif.GatewayAddress);
                //Debug.Print("PIN "+ pinStr.ToString());
                Hashtable ht = new Hashtable();
                ht.Add("Id", utenteCorrente.id);
                ht.Add("User", utenteCorrente.user);
                ht.Add("Pwd", utenteCorrente.pin);

                POSTContent content = Gadgeteer.Networking.POSTContent.CreateWebFormData(ht);
                var         request = HttpHelper.CreateHttpPostRequest(@"http://169.254.202.73/api/Utente/", content, "application/x-www-form-urlencoded");
                request.ResponseReceived += request_ResponseReceived_USER_PIN;

                request.SendRequest();
                HideButtons();
                return;
            }
            else if (carattere == 'e')
            {
                return;
            }

            if (ntoccou == 0 && carattere == 'c')
            {
                SetupDisplay();
            }

            if (ntoccou >= 0 && ntoccou <= 6)
            {
                if (carattere == 'c' && ntoccou != 0)
                {
                    if (ntoccou == 1)
                    {
                        userStr = "";
                        ntoccou = 0;
                        usernameValue.TextContent = "";
                        return;
                    }
                    else
                    {
                        userStr = userStr.Substring(0, ntoccou - 1);
                        ntoccou--;
                        usernameValue.TextContent = userStr;
                        return;
                    }
                }
                else if (carattere != 'c' && ntoccou != 6)
                {
                    userStr += carattere.ToString();
                    ntoccou++;
                    usernameValue.TextContent = userStr;
                    return;
                }
            }

            if (ntoccou >= 6 && ntoccou <= 10)
            {
                if (carattere == 'c' && ntoccou != 6)
                {
                    if (ntoccou == 7)
                    {
                        pinStr = "";
                        pinValue.TextContent = "";
                        ntoccou = 6;
                        ntoccop = 0;
                        return;
                    }
                    else
                    {
                        pinStr = pinStr.Substring(0, ntoccop - 1);
                        string tmp = "";
                        for (int j = 0; j < pinStr.Length; j++)
                        {
                            tmp += '*';
                        }
                        pinValue.TextContent = tmp;
                        ntoccop--;
                        ntoccou--;
                        return;
                    }
                }
                else if (carattere != 'c' && ntoccou != 10)
                {
                    pinStr += carattere.ToString();
                    pinValue.TextContent += '*';
                    ntoccou++;
                    ntoccop++;
                    return;
                }
            }
        }
Ejemplo n.º 24
0
 void blackButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     drawingColor = GT.Color.Black;
 }
Ejemplo n.º 25
0
 void clearButton_TouchUp(object sender, Microsoft.SPOT.Input.TouchEventArgs e)
 {
     background.Bitmap = new Bitmap(320 - sideBarWidth, 240);
     background.Invalidate();
 }