void ProgramStarted() { this.last = new Point(0, 0); this.touched = false; this.displayCP7.ScreenPressed += this.OnScreenPressed; this.displayCP7.ScreenReleased += this.OnScreenReleased; this.displayCP7.GestureDetected += this.OnGesureDetected; Glide.FitToScreen = true; Debug.Print("Program Started"); mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.mainWindow)); Image image = (Image)mainWindow.GetChildByName("earthImage"); image.Bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.main),Bitmap.BitmapImageType.Jpeg); mainWindow.BackColor = Microsoft.SPOT.Presentation.Media.Color.White; Glide.MainWindow = mainWindow; DateTime dateTime = new DateTime(2015, 12, 18, 20, 53, 0); Utility.SetLocalTime(dateTime); RealTimeClock.SetDateTime(dateTime); GHI.Glide.UI.Button myText = (GHI.Glide.UI.Button)mainWindow.GetChildByName("keyboard"); myText.PressEvent += new OnPress(Glide.OpenKeyboard); Gadgeteer.Timer timer = new Gadgeteer.Timer(500); timer.Tick += TimerTick; timer.Start(); }
//Starts a new row from the user public void startNewRow() { r1 = (GHI.Glide.UI.RadioButton)winPlayer2.GetChildByName("r1-" + currentGroup); r2 = (GHI.Glide.UI.RadioButton)winPlayer2.GetChildByName("r2-" + currentGroup); r3 = (GHI.Glide.UI.RadioButton)winPlayer2.GetChildByName("r3-" + currentGroup); r4 = (GHI.Glide.UI.RadioButton)winPlayer2.GetChildByName("r4-" + currentGroup); r1.OutlineColor = GHI.Glide.Colors.Red; r1.Invalidate(); }
// 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(); }
/**************** * FUNCTION * *************/ void first_step() { flagmdf = 0; /*button plus(input 4)*/ plus.ButtonPressed += Plus_ButtonPressed; plus.TurnLedOff(); /*button minus(input 5)*/ minus.ButtonPressed += Minus_ButtonPressed; minus.TurnLedOff(); Glide.FitToScreen = true; _mainwindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window)); GlideTouch.Initialize(); Glide.MainWindow = _mainwindow; /*create button to start*/ _startbtn = (GHI.Glide.UI.Button)_mainwindow.GetChildByName("startbtn"); /*press button event*/ _startbtn.PressEvent += Button_PressEvent; //_logo = (GHI.Glide.UI.Image)_mainwindow.GetChildByName("logo"); //_logo.Bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.logo), Bitmap.BitmapImageType.Jpeg); //_logo.Invalidate(); //Bitmap prova = new Bitmap(Resources.GetBytes(Resources.BinaryResources.logo), Bitmap.BitmapImageType.Gif); //displayTE35.SimpleGraphics.DisplayImage(prova, 30, 20); //displayTE35.BacklightEnabled = true; }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { //set display this.videoOut.SetDisplayConfiguration(VideoOut.Resolution.Vga800x600); //set glide window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm)); 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"); Glide.MainWindow = window; //LORA init _loraSerial = new SimpleSerial(GHI.Pins.FEZSpiderII.Socket11.SerialPortName, 57600); _loraSerial.Open(); _loraSerial.DataReceived += _loraSerial_DataReceived; //reset lora _restPort.Write(false); Thread.Sleep(1000); _restPort.Write(true); Thread.Sleep(1000); //setup lora for point to point //get lora version _loraSerial.WriteLine("sys get ver"); Thread.Sleep(1000); //pause join _loraSerial.WriteLine("mac pause"); Thread.Sleep(1000); //set antena power _loraSerial.WriteLine("radio set pwr 14"); Thread.Sleep(1000); //var DT = new DateTime(2016, 6, 19, 12, 43, 0); // This will set the clock to 9:30:00 on 9/15/2014 //RealTimeClock.SetDateTime(DT); //This will set the hardware Real-time Clock to what is in DT //Debug.Print("New Real-time Clock " + RealTimeClock.GetDateTime().ToString()); new Thread(SendData).Start(); //connect wifi SetupNetwork(); //sync time var result = Waktu.UpdateTimeFromNtpServer("time.nist.gov", 7); // Eastern Daylight Time Debug.Print(result ? "Time successfully updated" : "Time not updated"); }
/*apre pagina per il pagamento*/ private void _payBtn_TapEvent(object sender) { /*load pagamento*/ _pagamento = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Pagamento)); Glide.MainWindow = _pagamento; _paypal = (GHI.Glide.UI.TextBlock)_ordina.GetChildByName("paypal"); _pagamento.Invalidate(); }
// 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); //displayNHVN.Configure7InchDisplay(); window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm)); //glide init GlideTouch.Initialize(); btnReset = (GHI.Glide.UI.Button)window.GetChildByName("btnReset"); dataGrid = (GHI.Glide.UI.DataGrid)window.GetChildByName("dataGrid"); Glide.MainWindow = window; Thread th1 = new Thread(new ThreadStart(Looping)); th1.Start(); }
// 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(); }
void setup() { //rnd = new Random(); 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(); GvData = (DataGrid)MainWindow.GetChildByName("GvData"); GvData.AddColumn(new DataGridColumn("Time", 100)); GvData.AddColumn(new DataGridColumn("Temp 1", 100)); GvData.AddColumn(new DataGridColumn("Temp 2", 100)); GvData.AddColumn(new DataGridColumn("Water Dist", 100)); GvData.AddColumn(new DataGridColumn("Tds 1", 100)); GvData.AddColumn(new DataGridColumn("Tds 2", 100)); Random rnd = new Random(); counter = 0; Glide.MainWindow = MainWindow; //btn.ReleaseEvent += btn_ReleaseEvent; Glide.FitToScreen = true; //Thread th1 = new Thread(new ThreadStart(LoopButton)); //th1.Start(); //Mainboard.LDR0.OnInterrupt += LDR0_OnInterrupt; //Mainboard.LDR1.OnInterrupt += LDR1_OnInterrupt; //logs = new LogHelper(usbHost); xBeeAdapter.Configure(9600, SerialParity.None, SerialStopBits.One, 8, HardwareFlowControl.NotRequired); //StartLora(); xBeeAdapter.Port.LineReceived += Port_LineReceived; GT.Timer timer = new GT.Timer(5000); // every second (1000ms) timer.Tick += timer_Tick; timer.Start(); // Timeout 10 seconds int timeout = 1000 * 10; // Enable Watchdog GHI.Processor.Watchdog.Enable(timeout); // Start a time counter reset thread WDTCounterReset = new Thread(WDTCounterResetLoop); WDTCounterReset.Start(); // Normally, you can read this flag ***ONLY ONCE*** on power up if (GHI.Processor.Watchdog.LastResetCause == GHI.Processor.Watchdog.ResetCause.Watchdog) { //logs.WriteLogs("reset by watchdog"); Debug.Print("Watchdog did Reset"); } else { //logs.WriteLogs("system reboot / start"); Debug.Print("Reset switch or system power"); } }
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(); }
// 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 }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { //set display this.videoOut.SetDisplayConfiguration(VideoOut.Resolution.Vga800x600); //set glide window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1)); txtTime = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtTime"); GvData = (GHI.Glide.UI.DataGrid)window.GetChildByName("GvData"); BtnReset = (GHI.Glide.UI.Button)window.GetChildByName("BtnReset"); txtMessage = (GHI.Glide.UI.TextBlock)window.GetChildByName("TxtMessage"); Glide.MainWindow = window; //setup grid //create grid column GvData.AddColumn(new DataGridColumn("Time", 200)); GvData.AddColumn(new DataGridColumn("Temp", 200)); GvData.AddColumn(new DataGridColumn("Humid", 200)); GvData.AddColumn(new DataGridColumn("Light", 200)); GvData.AddColumn(new DataGridColumn("Gas", 200)); // Create a database in memory, // file system is possible however! myDatabase = new GHI.SQLite.Database(); myDatabase.ExecuteNonQuery("CREATE Table Sensor" + " (Time TEXT, Temp DOUBLE,Humid DOUBLE,Light DOUBLE,Gas DOUBLE)"); //reset database n display BtnReset.TapEvent += (object sender) => { Counter = 0; myDatabase.ExecuteNonQuery("DELETE FROM Sensor"); GvData.Clear(); GvData.Invalidate(); }; //reset lora _restPort.Write(false); Thread.Sleep(1000); _restPort.Write(true); Thread.Sleep(1000); _loraSerial = new SimpleSerial(GHI.Pins.FEZSpiderII.Socket11.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(1500); //antena power _loraSerial.WriteLine("radio set pwr 14"); Thread.Sleep(1500); //set device to receive _loraSerial.WriteLine("radio rx 0"); //set module to RX txtMessage.Text = "LORA-RN2483 setup has been completed..."; txtMessage.Invalidate(); window.Invalidate(); //myDatabase.Dispose(); }
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"); Auto_heating = (Button)Main_menu.GetChildByName("Auto_heating"); Auto_light = (Button)Main_menu.GetChildByName("Auto_light"); Auto_heating.PressEvent += Auto_heating_PressEvent; Auto_light.PressEvent += Auto_light_PressEvent; Up_motor.PressEvent += Up_motor_PressEvent; Up_motor.ReleaseEvent += Up_motor_ReleaseEvent; Down_motor.PressEvent += Down_motor_PressEvent; Down_motor.ReleaseEvent += Up_motor_ReleaseEvent; ((Button)Main_menu.GetChildByName("On_heating")).TapEvent += heatingOnTap; ((Button)Main_menu.GetChildByName("Off_heating")).TapEvent += heatingOffTap; ((Button)Main_menu.GetChildByName("On_light")).TapEvent += lightOnTap; ((Button)Main_menu.GetChildByName("Off_light")).TapEvent += lightOffTap; luminosityText = (TextBox)Main_menu.GetChildByName("Luminosity_box"); presenceText = (TextBox)Main_menu.GetChildByName("Presence_box"); temperatureText = (TextBox)Main_menu.GetChildByName("Temperature_box"); }
/*ordBtn TapEvent*/ void _ordBtn_PressEvent(object sender) { var random = new Random(System.DateTime.Now.Millisecond); uint randomNumber = (uint)random.Next(); string id_ordine = randomNumber.ToString(); string tot = price.ToString(); Hashtable order = new Hashtable(); order.Add("id", id_ordine); order.Add("price", tot); // Preparing order array list ArrayList foods = new ArrayList(); foreach (Product p in payment) { // Preparing food array list Hashtable new_food = new Hashtable(); new_food.Add("name", p.nome); new_food.Add("price", p.prezzo); Hashtable food = new Hashtable(); food.Add("food", new_food); food.Add("quantity", p.quantita); foods.Add(food); } order.Add("foods", foods); string order_as_json = Json.NETMF.JsonSerializer.SerializeObject(order); // TODO: MANDARE order_as_json al Desktop tramite Socket Debug.Print(order_as_json); /*load ordina*/ _ordina = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Ordina)); Glide.MainWindow = _ordina; _gridOrdine = (GHI.Glide.UI.DataGrid)_menu.GetChildByName("gridOrdine"); _annullaBtn = (GHI.Glide.UI.Button)_ordina.GetChildByName("annullaBtn"); _payBtn = (GHI.Glide.UI.Button)_ordina.GetChildByName("payBtn"); _mdfBtn = (GHI.Glide.UI.Button)_ordina.GetChildByName("mdfBtn"); _pfinal = (GHI.Glide.UI.TextBlock)_ordina.GetChildByName("pFinal"); _annullaBtn.TapEvent += _annullaBtn_TapEvent; _mdfBtn.TapEvent += _mdfBtn_TapEvent; _payBtn.TapEvent += _payBtn_TapEvent; /*Setup the dataGrid reference*/ _gridOrdine = (DataGrid)_ordina.GetChildByName("gridOrdine"); /*Create our four columns*/ _gridOrdine.AddColumn(new DataGridColumn("PIZZA", 125)); _gridOrdine.AddColumn(new DataGridColumn("PREZZO", 80)); _gridOrdine.AddColumn(new DataGridColumn("QNT", 50)); foreach (Product p in payment) { _gridOrdine.AddItem(new DataGridItem(new object[3] { p.nome, p.prezzo, p.quantita })); } _pfinal.Text = price.ToString(); _ordina.Invalidate(); _gridOrdine.Invalidate(); }
void initMenu() { Debug.Print("Init Menu!"); /*inizio socket*/ SocketClient.StartClient(); /*fine socket*/ /*load menu*/ _menu = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Menu)); Glide.MainWindow = _menu; _dataGrid = (GHI.Glide.UI.DataGrid)_menu.GetChildByName("dataGrid"); _pCounter = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("pCounter"); _qntCounter = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("qntCounter"); _errMsg = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("errMsg"); _ordBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("ordBtn"); if (flagmdf == 0) { _ordBtn.Enabled = false; } else { _ordBtn.Enabled = true; } _menu.Invalidate(); _ordBtn.PressEvent += _ordBtn_PressEvent; _deleteBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("deleteBtn"); if (flagmdf == 0) { _deleteBtn.Enabled = false; } else { _deleteBtn.Enabled = true; } _menu.Invalidate(); _deleteBtn.PressEvent += deleteBtn_PressEvent; //_ingBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("ingBtn"); //_ingBtn.Visible = false; //_menu.Invalidate(); //_ingBtn.PressEvent += ingBtn_PressEvent; /*Setup the dataGrid reference*/ _dataGrid = (DataGrid)_menu.GetChildByName("dataGrid"); // Listen for tap cell events. _dataGrid.TapCellEvent += new OnTapCell(dataGrid_TapCellEvent); /*Create our four columns*/ _dataGrid.AddColumn(new DataGridColumn("ID", 0)); _dataGrid.AddColumn(new DataGridColumn("PIZZA", 125)); _dataGrid.AddColumn(new DataGridColumn("PREZZO", 80)); _dataGrid.AddColumn(new DataGridColumn("QNT", 50)); /*Populate the data grid with random data*/ Populate(); /*Add the data grid to the window before rendering it*/ _menu.AddChild(_dataGrid); _dataGrid.Render(); /*Create a timer & run method timer_trick when thr timer ticks (for joystick)*/ GT.Timer timer = new GT.Timer(200); timer.Tick += Timer_Tick; timer.Start(); }
// 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 }