// 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;
        }
Beispiel #2
0
        /// <summary>
        /// Parses the ProgressBar XML into a UI component.
        /// </summary>
        /// <param name="reader">XML reader object.</param>
        /// <returns>ProgressBar object.</returns>
        private static ProgressBar LoadProgressBar(XmlReader reader)
        {
            string name = reader.GetAttribute("Name");
            ushort alpha = (reader.GetAttribute("Alpha") != null) ? Convert.ToUInt16(reader.GetAttribute("Alpha")) : _defaultDisplayObject.Alpha;
            int x = Convert.ToInt32(reader.GetAttribute("X"));
            int y = Convert.ToInt32(reader.GetAttribute("Y"));
            int width = Convert.ToInt32(reader.GetAttribute("Width"));
            int height = Convert.ToInt32(reader.GetAttribute("Height"));
            bool visible = (reader.GetAttribute("Visible") != null) ? (reader.GetAttribute("Visible") == bool.TrueString) : _defaultDisplayObject.Visible;
            bool enabled = (reader.GetAttribute("Enabled") != null) ? (reader.GetAttribute("Enabled") == bool.TrueString) : _defaultDisplayObject.Enabled;

            Direction direction;
            switch (reader.GetAttribute("Direction"))
            {
                case "Up":
                    direction = Direction.Up;
                    break;
                case "Left":
                    direction = Direction.Left;
                    break;
                case "Down":
                    direction = Direction.Down;
                    break;
                case "Right":
                default:
                    direction = Direction.Right;
                    break;
            }
            int maxValue = Convert.ToInt32(reader.GetAttribute("MaxValue"));
            int value = Convert.ToInt32(reader.GetAttribute("Value"));

            ProgressBar progressBar = new ProgressBar(name, alpha, x, y, width, height);
            progressBar.Visible = visible;
            progressBar.Enabled = enabled;
            progressBar.Direction = direction;
            progressBar.MaxValue = maxValue;
            progressBar.Value = value;

            return progressBar;
        }