//Initializes setup window.
        void initSetupWindow(GW.Window window)
        {
            // Create a Canvas
            GHI.Glide.UI.Canvas canvas = new GHI.Glide.UI.Canvas();
            _window.AddChild(canvas);

            // Draw a separator line.
            //canvas.DrawLine(GHI.Glide.Colors.White, 1, 30, 35, window.Width - 30, 35);

            // Draw a fieldset around our "Login" text block.
            _txtTitle           = (TextBlock)window.GetChildByName("txtTitle");
            _txtTitle.FontColor = GHI.Glide.Colors.White;
            canvas.DrawFieldset(_txtTitle, 90, 110, 220, GHI.Glide.Colors.White, 1);

            _txtBlWheelOut   = (TextBlock)_window.GetChildByName("txtBlWheelOut");
            _txtBlTriggerOut = (TextBlock)_window.GetChildByName("txtBlTriggerOut");
            _txtBlTrigScaled = (TextBlock)_window.GetChildByName("txtBlTrigScaled");
            _txtBlWhlScaled  = (TextBlock)_window.GetChildByName("txtBlWhlScaled");
            _txtBlSpeedLimit = (TextBlock)_window.GetChildByName("txtBlSpeedLimit");

            _chkBoxSpeedLimit           = (CheckBox)_window.GetChildByName("chkBoxSpeedLimit");
            _chkBoxSpeedLimit.TapEvent += _chkBoxSpeedLimit_TapEvent;

            _btnBackSetup           = (Button)_window.GetChildByName("btnBack");
            _btnBackSetup.TapEvent += new OnTap(btnBackSetup_TapEvent);

            _btnMode           = (Button)_window.GetChildByName("btnMode");
            _btnMode.TapEvent += new OnTap(btnMode_TapEvent);

            DiagnosticWindowTimer = new Timer(new TimerCallback(SetupWindowTimer_Tick), null, -1, diagnosticWindowTimerPeriod);
        }
示例#2
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            //Carga las ventanas
            controlWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.controlWindow));
            camaraWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.camaraWindow));
            GlideTouch.Initialize();

            //Inicializa los botones en la interface
            btn_start = (Button)controlWindow.GetChildByName("start");
            btn_stop = (Button)controlWindow.GetChildByName("stop");
            btn_start.TapEvent += btn_start_TapEvent;
            btn_stop.TapEvent += btn_stop_TapEvent;

            //Selecciona mainWindow como la ventana de inicio
            Glide.MainWindow = controlWindow;
        }
示例#3
0
        GT.Timer timerPictureCaptured;                                      // every second (1000ms)

        void ProgramStarted()
        {
            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            //Timer
            timer.Tick += timer_Tick;
            timer.Start();
            timerPictureCaptured       = new GT.Timer(9000);
            timerPictureCaptured.Tick += timerPictureCaptured_Tick;
            timerPictureCaptured.Start();

            //Load windows
            mainWindow        = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow));
            resultWindow      = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.ResultWindow));
            cameraWindow      = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.CameraWindow));
            BtnLeer           = (GHI.Glide.UI.Button)resultWindow.GetChildByName("BtnLeer");
            BtnLeer.TapEvent += BtnLeer_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = mainWindow;



            button.ButtonPressed += button_ButtonPressed;

            //Conexion a Internet
            this.ethernetJ11D.NetworkInterface.Open();
            //this.ethernetJ11D.NetworkInterface.EnableStaticIP("200.9.176.102", "255.255.255.128", "200.9.176.2");

            this.ethernetJ11D.NetworkInterface.EnableDhcp();
            //this.ethernetJ11D.UseStaticIP("200.9.176.102", "255.255.255.128","200.9.176.2");
            this.ethernetJ11D.UseThisNetworkInterface();
            this.ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;
            this.ethernetJ11D.NetworkUp   += ethernetJ11D_NetworkUp;



            //Funciones de Camara
            camera.BitmapStreamed  += camera_BitmapStreamed;
            camera.CameraConnected += camera_CameraConnected;
            camera.PictureCaptured += camera_PictureCaptured;
            systemState             = State.Camera;

            //imagen del qr
            currentBitmap = new Bitmap(camera.CurrentPictureResolution.Width, camera.CurrentPictureResolution.Height);
        }
示例#4
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            //Carga las ventanas
            controlWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.controlWindow));
            camaraWindow  = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.camaraWindow));
            GlideTouch.Initialize();

            //Inicializa los botones en la interface
            btn_start           = (Button)controlWindow.GetChildByName("start");
            btn_stop            = (Button)controlWindow.GetChildByName("stop");
            btn_start.TapEvent += btn_start_TapEvent;
            btn_stop.TapEvent  += btn_stop_TapEvent;

            //Selecciona mainWindow como la ventana de inicio
            Glide.MainWindow = controlWindow;
        }
示例#5
0
        void ProgramStarted()
        {
            sensor = new SensorProximidad(extender);

            Debug.Print("Program Started");


            camera.BitmapStreamed += camera_BitmapStreamed;


            controlWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.controlWindow));
            camaraWindow  = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.camaraWindow));
            GlideTouch.Initialize();


            btn_start           = (Button)controlWindow.GetChildByName("start");
            btn_stop            = (Button)controlWindow.GetChildByName("stop");
            btn_start.TapEvent += btn_start_TapEvent;
            btn_stop.TapEvent  += btn_stop_TapEvent;

            sensor.ObjectOn  += sensor_ObjectOn;
            sensor.ObjectOff += sensor_ObjectOff;

            Glide.MainWindow = controlWindow;
        }
示例#6
0
        private void MenuTap(object sender)
        {
            GHI.Glide.Display.Window Main_menu = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MAIN_MENU));
            Glide.MainWindow = Main_menu;

            this.setupCallbackManiMenu(Main_menu);
        }
示例#7
0
 public PromptForm(ref GHI.Glide.Display.Window window, ref DisplayDriver43 displayTE35, ref IDriveProvider sdCard, ref GHIElectronics.TinyCLR.Devices.UsbHost.UsbHostController usbHost) : base(ref window)
 {
     //this.usbClientEDP = usbClientEDP;
     this.usbHost     = usbHost;
     this.sdCard      = sdCard;
     this.displayTE35 = displayTE35;
 }
示例#8
0
        private void TempTap(object sender)
        {
            GHI.Glide.Display.Window SUB_TEMPERATURE_MENU = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.SUB_TEMPERATURE_MENU));
            Glide.MainWindow = SUB_TEMPERATURE_MENU;
            Button Main_temperature = (Button)SUB_TEMPERATURE_MENU.GetChildByName("Main_temperature");

            Main_temperature.TapEvent += MenuTap;
        }
示例#9
0
        private void LumTap(object sender)
        {
            GHI.Glide.Display.Window SUB_LUMINOSITY_MENU = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.SUB_LUMINOSITY_MENU));
            Glide.MainWindow = SUB_LUMINOSITY_MENU;
            Button Main_light = (Button)SUB_LUMINOSITY_MENU.GetChildByName("Main_light");

            Main_light.TapEvent += MenuTap;
        }
示例#10
0
 void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     ip = ethernetJ11D.NetworkSettings.IPAddress;
     //texto.Text = ip;
     tiempox();
     btn_news.Enabled        = true;
     btn_temperature.Enabled = true;
     pantalla = pantallaTiempo;
 }
示例#11
0
        void btn_temperature_TapEvent(object sender)
        {
            pantalla = pantallaTemperatura;
            Debug.Print("temperature");


            HttpRequest request = HttpHelper.CreateHttpGetRequest("http://api.openweathermap.org/data/2.5/weather?q=Guayaquil&mode=xml&appid=2de143494c0b295cca9337e1e96b00e0&lang=es");

            request.ResponseReceived += request_ResponseReceived;
            request.SendRequest();
            opcion = "temperatura";
        }
示例#12
0
 public IHM()
 {
     GlideTouch.Initialize();
     Debug.Print("IHM created");
     fenetreSelection = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.fenetreSelection));
     Glide.MainWindow = fenetreSelection;
     //Charge le fichier XML pour la fenetre de selection
     fenetreAffichage = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.fenetreAffichage));     // -- -- -- -- -- -- -- -- -- -- -- -- -- d'affichage
     fenetrePhase     = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.fenetrePhase));
     Debug.Print("IHM completed");
     Glide.FitToScreen = true;                   //Dimensionne la fenetre pour l'adapter à l'écran LCD
 }
示例#13
0
        void btn_news_TapEvent(object sender)
        {
            Debug.Print("news");
            HttpRequest request = HttpHelper.CreateHttpGetRequest("http://www.eluniverso.com/rss/deportes.xml");

            request.ResponseReceived += request_ResponseReceived;
            request.SendRequest();
            opcion = "noticias";
            labeld.ShowBackColor = true;
            labele.ShowBackColor = false;
            labelc.ShowBackColor = false;
            pantalla             = pantallaNoticias;
        }
示例#14
0
        private void showWindow()
        {
            GHI.Glide.Display.Window Main_menu = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MAIN_MENU));
            Glide.MainWindow = Main_menu;

            GlideTouch.Initialize();
            Glide.MainWindow.Invalidate();
            this.setupCallbackManiMenu(Main_menu);


            while (true)
            {
                Thread.Sleep(1000);
            }
        }
示例#15
0
        /// <summary>
        /// Loads a Window from XML bytes.
        /// </summary>
        /// <param name="xmlBytes">XML bytes.</param>
        /// <returns>Window object.</returns>
        public static Window LoadWindow(byte[] xmlBytes, bool render = true)
        {
            XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();

            xmlReaderSettings.IgnoreComments = true;
            xmlReaderSettings.IgnoreProcessingInstructions = true;
            xmlReaderSettings.IgnoreWhitespace = true;

            MemoryStream stream = new MemoryStream(xmlBytes);

            XmlReader reader = XmlReader.Create(stream, xmlReaderSettings);

            if(!reader.ReadToDescendant("Glide"))
                throw new ArgumentException("Glide not detected.");

            stream.Seek(0, SeekOrigin.Begin);
            reader = XmlReader.Create(stream, xmlReaderSettings);

            if (!reader.ReadToDescendant("Window"))
                throw new ArgumentException("XML does not contain a Window element.");

            _window = ParseWindow(reader);

            DisplayObject component;
            while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "Window"))
            {
                component = GetComponent(reader);

                if (component != null)
                    _window.AddChild(component);
                else
                    throw new Exception(reader.Name + " is not a valid UI component.");
            }

            reader.Close();

            if (render)
            {
                _window.Render();
            }

            return _window;
        }
示例#16
0
        private void setupCallbackManiMenu(GHI.Glide.Display.Window Main_menu)
        {
            Button Set_heating = (Button)Main_menu.GetChildByName("Set_heating");

            Set_heating.TapEvent += TempTap;

            Button Set_light = (Button)Main_menu.GetChildByName("Set_light");

            Set_light.TapEvent += LumTap;

            Button Up_motor   = (Button)Main_menu.GetChildByName("Up_motor");
            Button Down_motor = (Button)Main_menu.GetChildByName("Down_motor");

            Up_motor.PressEvent   += Up_motor_PressEvent;
            Up_motor.ReleaseEvent += Up_motor_ReleaseEvent;

            Down_motor.PressEvent   += Down_motor_PressEvent;
            Down_motor.ReleaseEvent += Up_motor_ReleaseEvent;
        }
        //Initializes ground efx window.
        void initGndEfxWindow(GW.Window window)
        {
            // Create a Canvas
            GHI.Glide.UI.Canvas canvas = new GHI.Glide.UI.Canvas();
            window.AddChild(canvas);

            // Draw a separator line.
            //canvas.DrawLine(GHI.Glide.Colors.White, 1, 30, 50, window.Width - 30, 50);

            // Draw a fieldset around our "Login" text block.
            _txtTitle           = (TextBlock)window.GetChildByName("txtTitle");
            _txtTitle.FontColor = GHI.Glide.Colors.White;
            canvas.DrawFieldset(_txtTitle, 40, 160, 220, GHI.Glide.Colors.White, 1);

            _btnGndEfxShow           = (Button)_window.GetChildByName("btnGndEfxShow");
            _btnGndEfxShow.TapEvent += new OnTap(btnGndEfxShow_TapEvent);

            _btnBackGndEfx           = (Button)_window.GetChildByName("btnBack");
            _btnBackGndEfx.TapEvent += new OnTap(btnBackGndEfx_TapEvent);
        }
        void ProgramStarted()
        {
            Glide.FitToScreen = true;

            //load screen from xml
            mainWindow    = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow));
            winMasterMind = new MasterMind();

            // reference for buttons from first screen
            btn1Player = (GHI.Glide.UI.Button)mainWindow.GetChildByName("btn1Player");
            btn2Player = (GHI.Glide.UI.Button)mainWindow.GetChildByName("btn2Player");

            btn1Player.TintColor = GHI.Glide.Colors.Red;


            //listeners from button clicked
            btn1Player.TapEvent += btn1Player_ButtonPressed;
            btn2Player.TapEvent += btn2Player_ButtonPressed;

            f             = Resources.GetFont(Resources.FontResources.NinaB);
            fontHeight    = f.Height;
            displayHeight = displayTE35.Height;

            // position for joystick
            double xPos = joystick.GetPosition().X;
            double yPos = joystick.GetPosition().Y;

            GT.Timer jt = new GT.Timer(275);

            jt.Tick += jt_Tick;

            joystick.JoystickPressed += joystick_JoystickPressed;
            jt.Start();

            button.ButtonPressed += button_ButtonPressed;

            Glide.MainWindow = mainWindow;
            GlideTouch.Initialize();
        }
        // Initializes main window buttons
        void initWindow(GW.Window window)
        {
            //Image imgLogo = (Image)window.GetChildByName("imgLogo");
            //imgLogo.Bitmap = Resources.GetBitmap(Resources.BitmapResources.Stinkmeaner_Thumb);

            // Create a Canvas
            GHI.Glide.UI.Canvas canvas = new GHI.Glide.UI.Canvas();
            window.AddChild(canvas);

            // Draw a separator line.
            canvas.DrawLine(GHI.Glide.Colors.White, 1, 30, 50, window.Width - 30, 50);

            // Draw a fieldset around our "Login" text block.
            _txtTitle           = (TextBlock)window.GetChildByName("txtTitle");
            _txtTitle.FontColor = GHI.Glide.Colors.White;
            canvas.DrawFieldset(_txtTitle, 30, 100, 220, GHI.Glide.Colors.White, 1);

            _pBarConnected       = (ProgressBar)_window.GetChildByName("pBarConnected");
            _pBarConnected.Value = 0;

            _txtStatus      = (TextBlock)_window.GetChildByName("txtStatus");
            _txtStatus.Text = "Status:";

            _btnBack           = (Button)_window.GetChildByName("btnBack");
            _btnBack.TapEvent += new OnTap(btnBack_TapEvent);

            _btnStop           = (Button)_window.GetChildByName("btnStop");
            _btnStop.TapEvent += new OnTap(btnStop_TapEvent);

            _btnSerialCam           = (Button)_window.GetChildByName("btnSerialCam");
            _btnSerialCam.TapEvent += new OnTap(btnSerialCam_TapEvent);

            _btnVideo           = (Button)_window.GetChildByName("btnVideo");
            _btnVideo.TapEvent += new OnTap(btnVideo_TapEvent);

            _btnSingleCam           = (Button)_window.GetChildByName("btnSingleCam");
            _btnSingleCam.TapEvent += new OnTap(btnSingleCam_TapEvent);
        }
 public SetupWindow()
 {
     _window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.wndSetup));
     initSetupWindow(_window);
 }
示例#21
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            ethernetJ11D.NetworkInterface.Open();
            ethernetJ11D.NetworkInterface.EnableDhcp();
            ethernetJ11D.UseThisNetworkInterface();
            //Carga la ventana principal

            pantallaTiempo = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaTiempo));
            pantallaTemperatura = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaTemperatura));
            pantallaNoticias = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaNoticias));
            GlideTouch.Initialize();

            //Inicializa el boton en la interface
            btn_temperature = (Button)pantallaTiempo.GetChildByName("clima");
            btn_news = (Button)pantallaTiempo.GetChildByName("noticias");
            deportes = (Button)pantallaNoticias.GetChildByName("deportes");
            cine = (Button)pantallaNoticias.GetChildByName("cine");
            economia = (Button)pantallaNoticias.GetChildByName("economia");
            atrastemp = (Button)pantallaTemperatura.GetChildByName("atras");
            atrasnews = (Button)pantallaNoticias.GetChildByName("atrasnews");
            //texto = (TextBlock)pantallaTiempo.GetChildByName("text_net_status");
            textotemp = (TextBlock)pantallaTiempo.GetChildByName("hora");
            fechatext = (TextBlock)pantallaTiempo.GetChildByName("fecha");
            msm = (TextBlock)pantallaTemperatura.GetChildByName("msm");
            temp = (TextBlock)pantallaTemperatura.GetChildByName("temp");
            n1 = (TextBlock)pantallaNoticias.GetChildByName("n1");
            n2 = (TextBlock)pantallaNoticias.GetChildByName("n2");
            labeld = (TextBlock)pantallaNoticias.GetChildByName("labeld");
            labelc = (TextBlock)pantallaNoticias.GetChildByName("labelc");
            labele = (TextBlock)pantallaNoticias.GetChildByName("labele");
            back = (Button)pantallaNoticias.GetChildByName("back");
            next = (Button)pantallaNoticias.GetChildByName("next");
            btn_temperature.TapEvent += btn_temperature_TapEvent;
            btn_news.TapEvent += btn_news_TapEvent;

            atrasnews.TapEvent += atrasnews_TapEvent;
            atrastemp.TapEvent += atrastemp_TapEvent;
            deportes.TapEvent += deportes_TapEvent;
            cine.TapEvent += cine_TapEvent;
            economia.TapEvent += economia_TapEvent;
            back.TapEvent += back_TapEvent;
            next.TapEvent += next_TapEvent;
            ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;
            ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp;
            timer.Tick += timer_Tick;
            timer2.Tick += timer2_Tick;

            //Selecciona iniciarWindow como la ventana de inicio
            Glide.MainWindow = pantallaTiempo;
            timer2.Start();
        }
示例#22
0
 void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
 {
     ip = ethernetJ11D.NetworkSettings.IPAddress;
     //texto.Text = ip;
     tiempox();
     btn_news.Enabled = true;
     btn_temperature.Enabled = true;
     pantalla = pantallaTiempo;
 }
示例#23
0
        void ProgramStarted()
        {
            Glide.FitToScreen = true;

            //load screen from xml
            mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow));
            winMasterMind = new MasterMind();

            // reference for buttons from first screen
            btn1Player = (GHI.Glide.UI.Button)mainWindow.GetChildByName("btn1Player");
            btn2Player = (GHI.Glide.UI.Button)mainWindow.GetChildByName("btn2Player");

            btn1Player.TintColor = GHI.Glide.Colors.Red;

            //listeners from button clicked
            btn1Player.TapEvent += btn1Player_ButtonPressed;
            btn2Player.TapEvent += btn2Player_ButtonPressed;

            f = Resources.GetFont(Resources.FontResources.NinaB);
            fontHeight = f.Height;
            displayHeight = displayTE35.Height;

            // position for joystick
            double xPos = joystick.GetPosition().X;
            double yPos = joystick.GetPosition().Y;
            GT.Timer jt = new GT.Timer(275);

            jt.Tick += jt_Tick;

            joystick.JoystickPressed += joystick_JoystickPressed;
            jt.Start();

            button.ButtonPressed += button_ButtonPressed;

            Glide.MainWindow = mainWindow;
            GlideTouch.Initialize();
        }
示例#24
0
文件: Tween.cs 项目: jakesays/Glide
        /// <summary>
        /// Slides between windows in a specified direction.
        /// </summary>
        /// <param name="fromWindow">From window.</param>
        /// <param name="toWindow">To window.</param>
        /// <param name="direction">Direction of movement.</param>
        public static void SlideWindow(Window fromWindow, Window toWindow, Direction direction)
        {
            Glide.MainWindow = null;
            int[] x1, x2, y1, y2;
            int fromY = fromWindow.Y - fromWindow.ListY;
            int toY = toWindow.Y - toWindow.ListY;
            int index;

            switch (direction)
            {
                case Direction.Left:
                    x1 = Tween.GetSteps(0, toWindow.Width, NumSteps.SlideWindow);
                    x2 = Tween.GetSteps(-fromWindow.Width, 0, NumSteps.SlideWindow);
                    index = 0;
                    while (index < x1.Length)
                    {
                        Glide.Screen.DrawImage(x1[index], fromY, fromWindow.Graphics.GetBitmap(), 0, 0, fromWindow.Width, fromWindow.Height);
                        Glide.Screen.DrawImage(x2[index], toY, toWindow.Graphics.GetBitmap(), 0, 0, toWindow.Width, toWindow.Height);
                        Glide.Screen.Flush();
                        index++;
                    }
                    Glide.MainWindow = toWindow;
                    break;

                case Direction.Right:
                    x1 = GetSteps(0, -fromWindow.Width, NumSteps.SlideWindow);
                    x2 = GetSteps(toWindow.Width, 0, NumSteps.SlideWindow);
                    index = 0;
                    while (index < x1.Length)
                    {
                        Glide.Screen.DrawImage(x1[index], fromY, fromWindow.Graphics.GetBitmap(), 0, 0, fromWindow.Width, fromWindow.Height);
                        Glide.Screen.DrawImage(x2[index], toY, toWindow.Graphics.GetBitmap(), 0, 0, toWindow.Width, toWindow.Height);
                        Glide.Screen.Flush();
                        index++;
                    }
                    Glide.MainWindow = toWindow;
                    break;

                case Direction.Up:
                    y1 = GetSteps(fromY, -fromWindow.Height, NumSteps.SlideWindow);
                    y2 = GetSteps(fromY + fromWindow.Height, toY, NumSteps.SlideWindow);
                    index = 0;
                    while (index < y1.Length)
                    {
                        Glide.Screen.DrawImage(0, y1[index], fromWindow.Graphics.GetBitmap(), 0, 0, fromWindow.Width, fromWindow.Height);
                        Glide.Screen.DrawImage(0, y2[index], toWindow.Graphics.GetBitmap(), 0, 0, toWindow.Width, toWindow.Height);
                        Glide.Screen.Flush();
                        index++;
                    }
                    Glide.MainWindow = toWindow;
                    break;

                case Direction.Down:
                    y1 = GetSteps(toY, fromWindow.Height, NumSteps.SlideWindow);
                    y2 = GetSteps(-fromWindow.Height, fromY, NumSteps.SlideWindow);
                    index = 0;
                    while (index < y1.Length)
                    {
                        Glide.Screen.DrawImage(0, y1[index], fromWindow.Graphics.GetBitmap(), 0, 0, fromWindow.Width, fromWindow.Height);
                        Glide.Screen.DrawImage(0, y2[index], toWindow.Graphics.GetBitmap(), 0, 0, toWindow.Width, toWindow.Height);
                        Glide.Screen.Flush();
                        index++;
                    }
                    Glide.MainWindow = toWindow;
                    break;
            }
        }
示例#25
0
        private void Close()
        {
            IsOpen = false;

            for (int i = 0; i < _window.NumChildren; i++)
                _window[i].Interactive = true;

            _window.RemoveChild(_canvas);
            _window.RemoveChild(_msgBox);
            _window.Invalidate();
            _window = null;

            GlideTouch.IgnoreAllEvents = false;
        }
 public EcoCamWindow()
 {
     _window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.EcoCam_Window));
     initWindow(_window);
 }
示例#27
0
        GT.Timer timer2 = new GT.Timer(900); // every second (1000ms)
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            ethernetJ11D.NetworkInterface.Open();
            ethernetJ11D.NetworkInterface.EnableDhcp();
            ethernetJ11D.UseThisNetworkInterface();
            //Carga la ventana principal

            pantallaTiempo      = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaTiempo));
            pantallaTemperatura = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaTemperatura));
            pantallaNoticias    = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaNoticias));
            GlideTouch.Initialize();

            //Inicializa el boton en la interface
            btn_temperature = (Button)pantallaTiempo.GetChildByName("clima");
            btn_news        = (Button)pantallaTiempo.GetChildByName("noticias");
            deportes        = (Button)pantallaNoticias.GetChildByName("deportes");
            cine            = (Button)pantallaNoticias.GetChildByName("cine");
            economia        = (Button)pantallaNoticias.GetChildByName("economia");
            atrastemp       = (Button)pantallaTemperatura.GetChildByName("atras");
            atrasnews       = (Button)pantallaNoticias.GetChildByName("atrasnews");
            //texto = (TextBlock)pantallaTiempo.GetChildByName("text_net_status");
            textotemp = (TextBlock)pantallaTiempo.GetChildByName("hora");
            fechatext = (TextBlock)pantallaTiempo.GetChildByName("fecha");
            msm       = (TextBlock)pantallaTemperatura.GetChildByName("msm");
            temp      = (TextBlock)pantallaTemperatura.GetChildByName("temp");
            n1        = (TextBlock)pantallaNoticias.GetChildByName("n1");
            n2        = (TextBlock)pantallaNoticias.GetChildByName("n2");
            labeld    = (TextBlock)pantallaNoticias.GetChildByName("labeld");
            labelc    = (TextBlock)pantallaNoticias.GetChildByName("labelc");
            labele    = (TextBlock)pantallaNoticias.GetChildByName("labele");
            back      = (Button)pantallaNoticias.GetChildByName("back");
            next      = (Button)pantallaNoticias.GetChildByName("next");
            btn_temperature.TapEvent += btn_temperature_TapEvent;
            btn_news.TapEvent        += btn_news_TapEvent;

            atrasnews.TapEvent       += atrasnews_TapEvent;
            atrastemp.TapEvent       += atrastemp_TapEvent;
            deportes.TapEvent        += deportes_TapEvent;
            cine.TapEvent            += cine_TapEvent;
            economia.TapEvent        += economia_TapEvent;
            back.TapEvent            += back_TapEvent;
            next.TapEvent            += next_TapEvent;
            ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;
            ethernetJ11D.NetworkUp   += ethernetJ11D_NetworkUp;
            timer.Tick  += timer_Tick;
            timer2.Tick += timer2_Tick;

            //Selecciona iniciarWindow como la ventana de inicio
            Glide.MainWindow = pantallaTiempo;
            timer2.Start();
        }
示例#28
0
 public MainMenuForm(ref GHI.Glide.Display.Window window) : base(ref window)
 {
 }
示例#29
0
        /// <summary>
        /// Shows a MessageBox on screen.
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="title">Title</param>
        /// <param name="buttons">MessageBoxButtons constant.</param>
        /// <returns></returns>
        public ModalResult Show(string message, string title, ModalButtons buttons)
        {
            _window = Glide.MainWindow;
            _result = ModalResult.None;
            _resetEvent = new ManualResetEvent(false);

            while (_msgBox.NumChildren > 0)
                _msgBox.RemoveChildAt(0);

            Update(message, title);

            Button abortBtn, okBtn, cancelBtn, retryBtn, ignoreBtn, yesBtn, noBtn;
            int startX;
            int buttonY = _msgBox.Height - 32 - 10;

            switch (buttons)
            {
                case ModalButtons.Ok:
                    okBtn = new Button("okBtn", 255, (_msgBox.Width - 50) / 2, buttonY, 50, 32);
                    okBtn.Text = "Ok";
                    okBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    okBtn.TapEvent += new OnTap(okBtn_TapEvent);
                    _msgBox.AddChild(okBtn);
                    break;

                case ModalButtons.OkCancel:
                    startX = (_msgBox.Width - (50 + 5 + 70)) / 2;

                    okBtn = new Button("okBtn", 255, startX, buttonY, 50, 32);
                    okBtn.Text = "Ok";
                    okBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    okBtn.TapEvent += new OnTap(okBtn_TapEvent);
                    _msgBox.AddChild(okBtn);

                    cancelBtn = new Button("cancelBtn", 255, okBtn.X + okBtn.Width + 5, buttonY, 70, 32);
                    cancelBtn.Text = "Cancel";
                    cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent);
                    _msgBox.AddChild(cancelBtn);
                    break;

                case ModalButtons.RetryCancel:
                    startX = (_msgBox.Width - (60 + 5 + 70)) / 2;

                    retryBtn = new Button("retryBtn", 255, startX, buttonY, 60, 32);
                    retryBtn.Text = "Retry";
                    retryBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    retryBtn.TapEvent += new OnTap(retryBtn_TapEvent);
                    _msgBox.AddChild(retryBtn);

                    cancelBtn = new Button("cancelBtn", 255, retryBtn.X + retryBtn.Width + 5, buttonY, 70, 32);
                    cancelBtn.Text = "Cancel";
                    cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent);
                    _msgBox.AddChild(cancelBtn);
                    break;

                case ModalButtons.AbortRetryIgnore:
                    startX = (_msgBox.Width - (60 + 5 + 60 + 5 + 70)) / 2;

                    abortBtn = new Button("abortBtn", 255, startX, buttonY, 60, 32);
                    abortBtn.Text = "Abort";
                    abortBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    abortBtn.TapEvent += new OnTap(abortBtn_TapEvent);
                    _msgBox.AddChild(abortBtn);

                    retryBtn = new Button("retryBtn", 255, abortBtn.X + abortBtn.Width + 5, buttonY, 60, 32);
                    retryBtn.Text = "Retry";
                    retryBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    retryBtn.TapEvent += new OnTap(retryBtn_TapEvent);
                    _msgBox.AddChild(retryBtn);

                    ignoreBtn = new Button("ignoreBtn", 255, retryBtn.X + retryBtn.Width + 5, buttonY, 70, 32);
                    ignoreBtn.Text = "Ignore";
                    ignoreBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    ignoreBtn.TapEvent += new OnTap(ignoreBtn_TapEvent);
                    _msgBox.AddChild(ignoreBtn);
                    break;

                case ModalButtons.YesNo:
                    startX = (_msgBox.Width - (55 + 5 + 60)) / 2;

                    yesBtn = new Button("yesBtn", 255, startX, buttonY, 55, 32);
                    yesBtn.Text = "Yes";
                    yesBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    yesBtn.TapEvent += new OnTap(yesBtn_TapEvent);
                    _msgBox.AddChild(yesBtn);

                    noBtn = new Button("noBtn", 255, yesBtn.X + yesBtn.Width + 5, buttonY, 50, 32);
                    noBtn.Text = "No";
                    noBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    noBtn.TapEvent += new OnTap(noBtn_TapEvent);
                    _msgBox.AddChild(noBtn);
                    break;

                case ModalButtons.YesNoCancel:
                    startX = (_msgBox.Width - (55 + 5 + 50 + 5 + 70)) / 2;

                    yesBtn = new Button("yesBtn", 255, startX, buttonY, 55, 32);
                    yesBtn.Text = "Yes";
                    yesBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    yesBtn.TapEvent += new OnTap(yesBtn_TapEvent);
                    _msgBox.AddChild(yesBtn);

                    noBtn = new Button("noBtn", 255, yesBtn.X + yesBtn.Width + 5, buttonY, 50, 32);
                    noBtn.Text = "No";
                    noBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    noBtn.TapEvent += new OnTap(noBtn_TapEvent);
                    _msgBox.AddChild(noBtn);

                    cancelBtn = new Button("cancelBtn", 255, noBtn.X + noBtn.Width + 5, buttonY, 70, 32);
                    cancelBtn.Text = "Cancel";
                    cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11);
                    cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent);
                    _msgBox.AddChild(cancelBtn);
                    break;
            }

            _forceClose = false;
            _touchThread = new Thread(TouchThread);
            _touchThread.Priority = ThreadPriority.AboveNormal;
            _touchThread.Start();

            Open();

            _resetEvent.WaitOne();

            Close();

            return _result;
        }
示例#30
0
 void atrastemp_TapEvent(object sender)
 {
     pantalla  = pantallaTiempo;
     temp.Text = "";
     msm.Text  = "";
 }
示例#31
0
        /// <summary>
        /// Parses the Window XML into a UI component.
        /// </summary>
        /// <param name="reader">XML reader object.</param>
        /// <returns>Window</returns>
        private static Window ParseWindow(XmlReader reader)
        {
            string name = reader.GetAttribute("Name");
            int width = Convert.ToInt32(reader.GetAttribute("Width"));
            int height = Convert.ToInt32(reader.GetAttribute("Height"));

            if (Glide.FitToScreen && (width < Glide.LCD.Width || height < Glide.LCD.Height))
            {
                width = Glide.LCD.Width;
                height = Glide.LCD.Height;
            }

            Color backColor = GlideUtils.Convert.ToColor(reader.GetAttribute("BackColor"));

            Window window = new Window(name, width, height);
            window.BackColor = backColor;

            return window;
        }
示例#32
0
 void atrasnews_TapEvent(object sender)
 {
     pantalla = pantallaTiempo;
     n1.Text  = "";
     n2.Text  = "";
 }
示例#33
0
 //imgFull
 public GameForm(ref GHI.Glide.Display.Window window, ref DisplayDriver43 displayTE35) : base(ref window)
 {
     this.displayTE35 = displayTE35;
 }
示例#34
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            ethernetJ11D.NetworkInterface.Open();
            ethernetJ11D.NetworkInterface.EnableDhcp();
            ethernetJ11D.UseThisNetworkInterface();
            //Carga la ventana principal
            iniciarWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.inicioWindow));
            pantallaTemperatura = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.pantallaTemperatura));
            GlideTouch.Initialize();

            //Inicializa el boton en la interface
            btn_inicio = (Button)iniciarWindow.GetChildByName("button_iniciar");
            atras = (Button)pantallaTemperatura.GetChildByName("atras");
            barra = (ProgressBar)pantallaTemperatura.GetChildByName("instance23061");
            texto = (TextBlock)iniciarWindow.GetChildByName("text_net_status");
            textotemp = (TextBlock)pantallaTemperatura.GetChildByName("valor");
            btn_inicio.TapEvent += btn_inicio_TapEvent;
            atras.TapEvent += atras_TapEvent;
            ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;
            ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp;
            timer.Tick += timer_Tick;

            //Selecciona iniciarWindow como la ventana de inicio
            Glide.MainWindow = iniciarWindow;
        }
        void btn_temperature_TapEvent(object sender)
        {
            pantalla = pantallaTemperatura;
            Debug.Print("temperature");

            HttpRequest request = HttpHelper.CreateHttpGetRequest("http://api.openweathermap.org/data/2.5/weather?q=Guayaquil&mode=xml&appid=2de143494c0b295cca9337e1e96b00e0&lang=es");
            request.ResponseReceived += request_ResponseReceived;
            request.SendRequest();
            opcion = "temperatura";
        }
示例#36
0
 void atrasnews_TapEvent(object sender)
 {
     pantalla = pantallaTiempo;
     n1.Text = "";
     n2.Text = "";
 }
 public OutputsWindow()
 {
     _window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.wndOutputs));
     initGndEfxWindow(_window);
 }
示例#38
0
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            //Timer
            timer.Tick += timer_Tick;
            timer.Start();
            timerPictureCaptured = new GT.Timer(9000);
            timerPictureCaptured.Tick += timerPictureCaptured_Tick;
            timerPictureCaptured.Start();

            //Load windows
            mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow));
            resultWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.ResultWindow));
            cameraWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.CameraWindow));
            BtnLeer = (GHI.Glide.UI.Button)resultWindow.GetChildByName("BtnLeer");
            BtnLeer.TapEvent += BtnLeer_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = mainWindow;

            button.ButtonPressed += button_ButtonPressed;

            //Conexion a Internet
            this.ethernetJ11D.NetworkInterface.Open();
            //this.ethernetJ11D.NetworkInterface.EnableStaticIP("200.9.176.102", "255.255.255.128", "200.9.176.2");

            this.ethernetJ11D.NetworkInterface.EnableDhcp();
            //this.ethernetJ11D.UseStaticIP("200.9.176.102", "255.255.255.128","200.9.176.2");
            this.ethernetJ11D.UseThisNetworkInterface();
            this.ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;
            this.ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp;

            //Funciones de Camara
            camera.BitmapStreamed += camera_BitmapStreamed;
            camera.CameraConnected += camera_CameraConnected;
            camera.PictureCaptured += camera_PictureCaptured;
            systemState = State.Camera;

            //imagen del qr
            currentBitmap = new Bitmap(camera.CurrentPictureResolution.Width, camera.CurrentPictureResolution.Height);
        }
示例#39
0
 void atrastemp_TapEvent(object sender)
 {
     pantalla = pantallaTiempo;
     temp.Text = "";
     msm.Text = "";
 }
示例#40
0
 public Screen(ref GHI.Glide.Display.Window window)
 {
     MainWindow = window;
 }
示例#41
0
 void btn_news_TapEvent(object sender)
 {
     Debug.Print("news");
     HttpRequest request = HttpHelper.CreateHttpGetRequest("http://www.eluniverso.com/rss/deportes.xml");
     request.ResponseReceived += request_ResponseReceived;
     request.SendRequest();
     opcion = "noticias";
     labeld.ShowBackColor = true;
     labele.ShowBackColor = false;
     labelc.ShowBackColor = false;
     pantalla = pantallaNoticias;
 }
示例#42
0
 public SplashForm(ref GHI.Glide.Display.Window window) : base(ref window)
 {
 }
示例#43
0
        void btn_temperature_TapEvent(object sender)
        {
            pantalla = pantallaTemperatura;
            Debug.Print("temperature");

            HttpRequest request = HttpHelper.CreateHttpGetRequest("http://api.openweathermap.org/data/2.5/weather?q=Guayaquil&mode=xml&appid=d3fb3b8eb0730860e148d39896bc1ee3&lang=es");
            request.ResponseReceived += request_ResponseReceived;
            request.SendRequest();
            opcion = "temperatura";
        }