Пример #1
0
        public override void Init(params string[] Param)
        {
            LinesOfCode = new ArrayList();
            LineCounter = 0;
            bmp         = new Bitmap(WidthScreen, HeightScreen);
            MainWindow  = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.ExecuteForm));

            imgCode = (GHI.Glide.UI.Image)MainWindow.GetChildByName("imgCode");
            btnBack = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnBack");

            Glide.MainWindow = MainWindow;

            myFont = Resources.GetFont(Resources.FontResources.NinaB);
            SBASIC s = new SBASIC();

            Thread.Sleep(500);

            s.Print            += S_Print;
            s.ClearScreen      += S_ClearScreen;
            btnBack.PressEvent += (sender) =>
            {
                s.Print       -= S_Print;
                s.ClearScreen -= S_ClearScreen;
                CallFormRequestEvent(ScreenTypes.Editor);
            };
            //execute the code
            s.Run(Param[0]);
            //MainWindow.Invalidate();
        }
Пример #2
0
        /// <summary>
        /// Testing method for DisplayNHVN module
        /// </summary>
        private static void TestGlide()
        {
            var lcd = new DisplayNHVN(GHIElectronics.TinyCLR.Pins.FEZRaptor.I2cBus.Socket13, FEZRaptor.Socket16.Pin9, FEZRaptor.Socket13.Pin3,
                                      DisplayNHVN.DisplayTypes.Display7inch);

            Glide.SetupGlide(800, 480, 96, 0, lcd.displayController);
            string GlideXML = @"<Glide Version=""1.0.7""><Window Name=""instance115"" Width=""800"" Height=""480"" BackColor=""dce3e7""><Button Name=""btn"" X=""40"" Y=""60"" Width=""120"" Height=""40"" Alpha=""255"" Text=""Click Me"" Font=""4"" FontColor=""000000"" DisabledFontColor=""808080"" TintColor=""000000"" TintAmount=""0""/><TextBlock Name=""TxtTest"" X=""42"" Y=""120"" Width=""650"" Height=""32"" Alpha=""255"" Text=""TextBlock"" TextAlign=""Left"" TextVerticalAlign=""Top"" Font=""6"" FontColor=""0"" BackColor=""000000"" ShowBackColor=""False""/></Window></Glide>";

            //Resources.GetString(Resources.StringResources.Window)
            Window window = GlideLoader.LoadWindow(GlideXML);

            GlideTouch.Initialize();

            GHI.Glide.UI.Button    btn = (GHI.Glide.UI.Button)window.GetChildByName("btn");
            GHI.Glide.UI.TextBlock txt = (GHI.Glide.UI.TextBlock)window.GetChildByName("TxtTest");
            btn.TapEvent += (object sender) =>
            {
                txt.Text = "Welcome to Glide for TinyCLR - Cheers from Mif ;)";
                Debug.WriteLine("Button tapped.");

                window.Invalidate();
                txt.Invalidate();
            };

            Glide.MainWindow = window;

            lcd.CapacitiveScreenReleased += Lcd_CapacitiveScreenReleased;
            lcd.CapacitiveScreenPressed  += Lcd_CapacitiveScreenPressed;

            //Thread.Sleep(Timeout.Infinite);
        }
Пример #3
0
        private void InitializeDisplay()
        {
            _window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

            GlideTouch.Initialize();

            _buttons = new UIButton[5];

            _forwardButton           = (UIButton)_window.GetChildByName("forwardButton");
            _forwardButton.TapEvent += s => Move(Action.Forward);
            _buttons[0]              = _forwardButton;

            _backwardButton           = (UIButton)_window.GetChildByName("backwardButton");
            _backwardButton.TapEvent += s => Move(Action.Backward);
            _buttons[1] = _backwardButton;

            _leftButton           = (UIButton)_window.GetChildByName("leftButton");
            _leftButton.TapEvent += s => Move(Action.Left);
            _buttons[2]           = _leftButton;

            _rightButton           = (UIButton)_window.GetChildByName("rightButton");
            _rightButton.TapEvent += s => Move(Action.Right);
            _buttons[3]            = _rightButton;

            _stopButton           = (UIButton)_window.GetChildByName("stopButton");
            _stopButton.TapEvent += s => Move(Action.Stop);
            _buttons[4]           = _stopButton;

            _logTextBlock = (UITextBlock)_window.GetChildByName("logTextBlock");

            Glide.FitToScreen = true;

            Glide.MainWindow = _window;
        }
Пример #4
0
 private void SetButtonTintAmount(UIButton selectedButton)
 {
     foreach (var button in _buttons)
     {
         button.TintAmount = button.Equals(selectedButton) ? MaxTintAmount : MinTintAmount;
         UpdateDisplayObject(button);
     }
 }
Пример #5
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket14.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            JoinWifi();
            Thread.Sleep(500);
            if (client == null)
            {
                // create client instance
                MQTT_BROKER_ADDRESS = "cloud.makestro.com";
                client = new MqttClient(MQTT_BROKER_ADDRESS);
                string clientId = Guid.NewGuid().ToString();
                client.Connect(clientId, "mifmasterz", "123qweasd");
                SubscribeMessage();
            }
            Thread th1 = new Thread(new ThreadStart(Loop));

            th1.Start();
        }
Пример #6
0
        public static void showWindowPinCorto()
        {
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_pin_corto));

            GHI.Glide.UI.Button btnTryAgain = (GHI.Glide.UI.Button)window.GetChildByName("tryagain");

            btnTryAgain.TapEvent += btnTryAgain_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #7
0
        public static void showWindowNotRegistered()
        {
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_not_regitered));

            GHI.Glide.UI.Button btnBack = (GHI.Glide.UI.Button)window.GetChildByName("back");

            btnBack.TapEvent += btnRetryerrorpin_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #8
0
        public override void Init(params string[] Param)
        {
            sdCard.Mounted += (SDCard sender, GT.StorageDevice device) =>
            {
                PopulateList();
            };
            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.EditorForm));
            //populate Code data
            PopulateList();

            txtCode           = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtCode");
            btnExec           = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnExec");
            btnClear          = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnClear");
            txtCode.TapEvent += new OnTap(Glide.OpenKeyboard);

            listFile.CloseEvent += (object sender) =>
            {
                Glide.CloseList();
            };

            cmbFile           = (GHI.Glide.UI.Dropdown)MainWindow.GetChildByName("cmbFile");
            cmbFile.TapEvent += (object sender) =>
            {
                Glide.OpenList(sender, listFile);
            };
            cmbFile.ValueChangedEvent += (object sender) =>
            {
                var dropdown = (GHI.Glide.UI.Dropdown)sender;
                if (dropdown.Value == null)
                {
                    return;
                }
                var data = sdCard.StorageDevice.ReadFile(dropdown.Value.ToString());
                txtCode.Text = new string(Encoding.UTF8.GetChars(data));
                txtCode.Invalidate();
                //Debug.Print("Dropdown value: " + dropdown.Text + " : " + dropdown.Value.ToString());
            };

            btnExec.PressEvent += (sender) =>
            {
                CallFormRequestEvent(ScreenTypes.Executor, txtCode.Text);
            };

            btnClear.PressEvent += (sender) =>
            {
                txtCode.Text = string.Empty;
            };
            Glide.MainWindow = MainWindow;
            //MainWindow.Invalidate();
        }
Пример #9
0
        public static void showWindowCameraDown()
        {
            if (!Program.NetworkUp)
            {
                showWindowNetworkDown();
                return;
            }
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_camera_down));

            GHI.Glide.UI.Button camButton = (GHI.Glide.UI.Button)window.GetChildByName("retry");

            camButton.TapEvent += camButton_TapEvent;

            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #10
0
        public static void showWindowErrorPin()
        {
            if (!Program.NetworkUp)
            {
                showWindowNetworkDown();
                return;
            }
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_error_pin));

            GHI.Glide.UI.Button btnRetryerrorpin = (GHI.Glide.UI.Button)window.GetChildByName("retry");

            btnRetryerrorpin.TapEvent += btnRetryerrorpin_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #11
0
        public static void showWindowServerDown()
        {
            if (!Program.NetworkUp)
            {
                showWindowNetworkDown();
                return;
            }
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_server_down));

            GHI.Glide.UI.Button btnRestart = (GHI.Glide.UI.Button)window.GetChildByName("restart");

            btnRestart.TapEvent += btnRestart_TapEvent;
            GlideTouch.Initialize();
            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #12
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket14.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            Thread th1 = new Thread(new ThreadStart(Loop));

            th1.Start();
        }
Пример #13
0
        public static void setupWindowInsertPin()
        {
            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window));

            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn1 = (GHI.Glide.UI.Button)window.GetChildByName("button1");
            GHI.Glide.UI.Button btn2 = (GHI.Glide.UI.Button)window.GetChildByName("button2");
            GHI.Glide.UI.Button btn3 = (GHI.Glide.UI.Button)window.GetChildByName("button3");
            GHI.Glide.UI.Button btn4 = (GHI.Glide.UI.Button)window.GetChildByName("button4");
            GHI.Glide.UI.Button btn5 = (GHI.Glide.UI.Button)window.GetChildByName("button5");
            GHI.Glide.UI.Button btn6 = (GHI.Glide.UI.Button)window.GetChildByName("button6");
            GHI.Glide.UI.Button btn7 = (GHI.Glide.UI.Button)window.GetChildByName("button7");
            GHI.Glide.UI.Button btn8 = (GHI.Glide.UI.Button)window.GetChildByName("button8");
            btn1.TapEvent += btn1_TapEvent;

            Glide.MainWindow = window;
        }
Пример #14
0
        public static void showWindowInsertPin()
        {
            if (!Program.NetworkUp && !Program.setupComplete)
            {
                showWindowNetworkDown();
                return;
            }

            Window window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.window_pin));

            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn1   = (GHI.Glide.UI.Button)window.GetChildByName("button1");
            GHI.Glide.UI.Button btn2   = (GHI.Glide.UI.Button)window.GetChildByName("button2");
            GHI.Glide.UI.Button btn3   = (GHI.Glide.UI.Button)window.GetChildByName("button3");
            GHI.Glide.UI.Button btn4   = (GHI.Glide.UI.Button)window.GetChildByName("button4");
            GHI.Glide.UI.Button btn5   = (GHI.Glide.UI.Button)window.GetChildByName("button5");
            GHI.Glide.UI.Button btn6   = (GHI.Glide.UI.Button)window.GetChildByName("button6");
            GHI.Glide.UI.Button btn7   = (GHI.Glide.UI.Button)window.GetChildByName("button7");
            GHI.Glide.UI.Button btn8   = (GHI.Glide.UI.Button)window.GetChildByName("button8");
            GHI.Glide.UI.Button btn9   = (GHI.Glide.UI.Button)window.GetChildByName("button9");
            GHI.Glide.UI.Button btn0   = (GHI.Glide.UI.Button)window.GetChildByName("button0");
            GHI.Glide.UI.Button btnOk  = (GHI.Glide.UI.Button)window.GetChildByName("button_ok");
            GHI.Glide.UI.Button btnDel = (GHI.Glide.UI.Button)window.GetChildByName("button_del");
            password         = (GHI.Glide.UI.PasswordBox)window.GetChildByName("textpassword");
            password.Enabled = true;

            btn1.TapEvent   += btn1_TapEvent;
            btn2.TapEvent   += btn2_TapEvent;
            btn3.TapEvent   += btn3_TapEvent;
            btn4.TapEvent   += btn4_TapEvent;
            btn5.TapEvent   += btn5_TapEvent;
            btn6.TapEvent   += btn6_TapEvent;
            btn7.TapEvent   += btn7_TapEvent;
            btn8.TapEvent   += btn8_TapEvent;
            btn9.TapEvent   += btn9_TapEvent;
            btn0.TapEvent   += btn0_TapEvent;
            btnDel.TapEvent += btnDel_TapEvent;
            btnOk.TapEvent  += btnOk_TapEvent;

            Glide.MainWindow = window;
            Glide.MainWindow.Invalidate();
        }
Пример #15
0
        public override void Init(params string[] Param)
        {
            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MenuForm));
            ArrayList control = new ArrayList();
            for (int i = 1; i < 5; i++)
            {
                var img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("Img" + i);
                control.Add(img);
                GT.Picture pic = null;
                switch (i)
                {
                    case 1:
                        pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.game), GT.Picture.PictureEncoding.JPEG);
                        img.Bitmap = pic.MakeBitmap();
                        break;
                    case 2:
                        pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.gallery), GT.Picture.PictureEncoding.JPEG);
                        img.Bitmap = pic.MakeBitmap();
                        break;
                    case 3:
                        pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.myroom), GT.Picture.PictureEncoding.JPEG);
                        img.Bitmap = pic.MakeBitmap();
                        break;
                    case 4:
                        pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.message), GT.Picture.PictureEncoding.JPEG);
                        img.Bitmap = pic.MakeBitmap();
                        break;
                }
                var Btn = (GHI.Glide.UI.Button)MainWindow.GetChildByName("Btn" + i);
                if (i == 4)
                {
                    BtnInbox = Btn;
                }
                control.Add(Btn);
                Btn.PressEvent += (sender) =>
                {
                    var btn = sender as GHI.Glide.UI.Button;
                    switch (btn.Name)
                    {
                        case "Btn1":
                            CallFormRequestEvent(ScreenTypes.Game);
                            break;
                        case "Btn2":
                            CallFormRequestEvent(ScreenTypes.Gallery);
                            break;
                        case "Btn3":
                            CallFormRequestEvent(ScreenTypes.MyRoom);
                            break;
                        case "Btn4":
                            CallFormRequestEvent(ScreenTypes.Inbox);
                            break;
                    }
                };
            }

            Glide.MainWindow = MainWindow;
            //MainWindow.Invalidate();
        }
Пример #16
0
        void setup()
        {
            /*
             * //7" Displays
             * Display.Width = 800;
             * Display.Height = 480;
             * Display.OutputEnableIsFixed = false;
             * Display.OutputEnablePolarity = true;
             * Display.PixelPolarity = false;
             * Display.PixelClockRateKHz = 30000;
             * Display.HorizontalSyncPolarity = false;
             * Display.HorizontalSyncPulseWidth = 48;
             * Display.HorizontalBackPorch = 88;
             * Display.HorizontalFrontPorch = 40;
             * Display.VerticalSyncPolarity = false;
             * Display.VerticalSyncPulseWidth = 3;
             * Display.VerticalBackPorch = 32;
             * Display.VerticalFrontPorch = 13;
             * Display.Type = Display.DisplayType.Lcd;
             * if (Display.Save())      // Reboot required?
             * {
             *  PowerState.RebootDevice(false);
             * }*/
            Display.Width = 800;

            Display.Height = 480;

            Display.HorizontalSyncPulseWidth = 1;

            Display.HorizontalBackPorch = 88;

            Display.HorizontalFrontPorch = 40;

            Display.VerticalSyncPulseWidth = 3;

            Display.VerticalBackPorch = 32;

            Display.VerticalFrontPorch = 13;

            Display.PixelClockRateKHz = 25000;

            Display.OutputEnableIsFixed = true;

            Display.OutputEnablePolarity = true;

            Display.HorizontalSyncPolarity = false;

            Display.VerticalSyncPolarity = false;

            Display.PixelPolarity = true;

            Display.Type = Display.DisplayType.Lcd;



            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }

            //init touch

            i2cDevice = new I2CDevice(new I2CDevice.Configuration(0x38, 400));

            CapDriver = new CapTouchDriver(i2cDevice);

            CapDriver.SetBacklightTime(0);

            CapDriver.ResetBacklight();



            //CapacitiveTouchController.Initialize(GHI.Pins.G120.P2_21);

            //CapacitiveTouchController.Initialize(GHI.Pins.FEZCobraII.Socket4.Pin3);
            GlideTouch.Initialize();

            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));
            img        = (GHI.Glide.UI.Image)MainWindow.GetChildByName("img");
            btn        = (GHI.Glide.UI.Button)MainWindow.GetChildByName("BtnChange");
            txt        = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtStatus");
            GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
            img.Bitmap        = pic.MakeBitmap();
            Glide.MainWindow  = MainWindow;
            btn.ReleaseEvent += btn_ReleaseEvent;
            Glide.FitToScreen = true;
            //Thread th1 = new Thread(new ThreadStart(LoopButton));
            //th1.Start();
        }
Пример #17
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket13.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);

            _loraSerial = new SimpleSerial(GHI.Pins.FEZRaptor.Socket10.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //get version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1000);
            //antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1000);
            //set device to receive
            _loraSerial.WriteLine("radio rx 0"); //set module to RX
        }
Пример #18
0
        public override void Init(params string[] Param)
        {
            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainMenu));
            ArrayList control = new ArrayList();

            for (int i = 1; i < 5; i++)
            {
                var img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("Img" + i);
                control.Add(img);
                //Bitmap pic = null;//GT.Picture
                switch (i)
                {
                case 1:
                    //pic = Resources.GetBitmap(Resources.BitmapResources.game); //new GT.Picture(Resources.GetBytes(Resources.BinaryResources.game), GT.Picture.PictureEncoding.JPEG);
                    img.Bitmap = Resources.GetBitmap(Resources.BitmapResources.game);    //pic;//.MakeBitmap();
                    break;

                case 2:
                    //pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.gallery), GT.Picture.PictureEncoding.JPEG);
                    img.Bitmap = Resources.GetBitmap(Resources.BitmapResources.gallery);    //pic.MakeBitmap();
                    break;

                case 3:
                    //pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.myroom), GT.Picture.PictureEncoding.JPEG);
                    img.Bitmap = Resources.GetBitmap(Resources.BitmapResources.myroom);    //pic.MakeBitmap();
                    break;

                case 4:
                    //pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.message), GT.Picture.PictureEncoding.JPEG);
                    img.Bitmap = Resources.GetBitmap(Resources.BitmapResources.message);    //pic.MakeBitmap();
                    break;
                }
                var Btn = (GHI.Glide.UI.Button)MainWindow.GetChildByName("Btn" + i);
                if (i == 4)
                {
                    BtnInbox = Btn;
                }
                control.Add(Btn);
                Btn.PressEvent += (sender) =>
                {
                    var btn = sender as GHI.Glide.UI.Button;
                    switch (btn.Name)
                    {
                    case "Btn1":
                        CallFormRequestEvent(ScreenTypes.Game);
                        break;

                    case "Btn2":
                        CallFormRequestEvent(ScreenTypes.Gallery);
                        break;

                    case "Btn3":
                        CallFormRequestEvent(ScreenTypes.MyRoom);
                        break;

                    case "Btn4":
                        CallFormRequestEvent(ScreenTypes.Inbox);
                        break;
                    }
                };
            }

            Glide.MainWindow = MainWindow;
            //MainWindow.Invalidate();
        }