public override void Init(params string[] Param) { MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyRoomForm)); ArrayList control = new ArrayList(); GT.Picture pic = null; var imgTemp = (GHI.Glide.UI.Image)MainWindow.GetChildByName("imgTemp"); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.temperature), GT.Picture.PictureEncoding.JPEG); imgTemp.Bitmap = pic.MakeBitmap(); control.Add(imgTemp); var imgLight = (GHI.Glide.UI.Image)MainWindow.GetChildByName("imgLight"); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.light), GT.Picture.PictureEncoding.JPEG); imgLight.Bitmap = pic.MakeBitmap(); control.Add(imgLight); var imgHumid = (GHI.Glide.UI.Image)MainWindow.GetChildByName("imgHumid"); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.humidity), GT.Picture.PictureEncoding.JPEG); imgHumid.Bitmap = pic.MakeBitmap(); control.Add(imgHumid); GT.Timer timer = new GT.Timer(2000); var Btn = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnBack"); control.Add(Btn); Btn.PressEvent += (sender) => { timer.Stop(); CallFormRequestEvent(ScreenTypes.MainMenu); }; txtTemp = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtTemp"); txtHumid = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtHumid"); txtLight = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtLight"); Glide.MainWindow = MainWindow; timer.Tick += (a) => { var measure = tempHumidSI70.TakeMeasurement(); txtTemp.Text = Toolbox.NETMF.Tools.Round((float)measure.Temperature, 2);// + "C"; txtHumid.Text = Toolbox.NETMF.Tools.Round((float)measure.RelativeHumidity);// + "%"; txtLight.Text = Toolbox.NETMF.Tools.Round((float)lightSense.GetIlluminance());// + "Lux"; //MainWindow.Graphics.DrawRectangle(txtTemp.Rect, MainWindow.BackColor, 255); //MainWindow.Graphics.DrawRectangle(txtHumid.Rect, MainWindow.BackColor, 255); //MainWindow.Graphics.DrawRectangle(txtLight.Rect, MainWindow.BackColor, 255); txtTemp.Invalidate(); txtHumid.Invalidate(); txtLight.Invalidate(); MainWindow.Invalidate(); }; timer.Start(); //MainWindow.Invalidate(); }
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(); }
public override void Init(params string[] Param) { GameIsOver = false; Turn = PlayerChips.X; MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.GameForm)); Control = new Hashtable(); GT.Picture pic = null; Box = new Hashtable(); ImgFull = (GHI.Glide.UI.Image)MainWindow.GetChildByName("imgFull"); ImgFull.Visible = false; for (int i = 1; i <= 9; i++) { var imgTemp = (GHI.Glide.UI.Image)MainWindow.GetChildByName("box" + i); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.blank), GT.Picture.PictureEncoding.JPEG); imgTemp.Bitmap = pic.MakeBitmap(); Control.Add(i, imgTemp); Box.Add(i, PlayerChips.Blank); imgTemp.TapEvent += (x) => { if (Turn == PlayerChips.X) { var img = x as GHI.Glide.UI.Image; var PinSel = int.Parse(img.Name.Substring(3)); Choose(PinSel); } }; if (i <= 2) { var linehor = (GHI.Glide.UI.Image)MainWindow.GetChildByName("line" + i); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.linehor), GT.Picture.PictureEncoding.JPEG); linehor.Bitmap = pic.MakeBitmap(); } else if (i <= 4) { var linever = (GHI.Glide.UI.Image)MainWindow.GetChildByName("line" + i); pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.linever), GT.Picture.PictureEncoding.JPEG); linever.Bitmap = pic.MakeBitmap(); } } Glide.MainWindow = MainWindow; //MainWindow.Invalidate(); }
void Choose(int Pos) { if (GameIsOver) return; var box = (PlayerChips)Box[Pos]; if (box == PlayerChips.Blank) { var img = (GHI.Glide.UI.Image)Control[Pos]; Box[Pos] = Turn; if (Turn == PlayerChips.X) { var tmp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.x), GT.Picture.PictureEncoding.JPEG); img.Bitmap = tmp.MakeBitmap(); Turn = PlayerChips.O; } else { var tmp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.o), GT.Picture.PictureEncoding.JPEG); img.Bitmap = tmp.MakeBitmap(); Turn = PlayerChips.X; } img.Invalidate(); if (CheckWin()) { GameIsOver = true; //load game over Bitmap bmp = null; if (Winner == PlayerChips.X) { var tmp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.WIN), GT.Picture.PictureEncoding.JPEG); bmp = tmp.MakeBitmap(); } else if (Winner == PlayerChips.O) { var tmp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.LOSE), GT.Picture.PictureEncoding.JPEG); bmp = tmp.MakeBitmap(); } else { var tmp = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.draw), GT.Picture.PictureEncoding.JPEG); bmp = tmp.MakeBitmap(); } ImgFull.Visible = true; ImgFull.Bitmap = bmp; ImgFull.Invalidate(); Thread.Sleep(3000); CallFormRequestEvent(ScreenTypes.MainMenu); } else if (Turn == PlayerChips.O) { Thread.Sleep(500); ComMove(); } } }
public override void Init(params string[] Param) { MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.SplashForm)); var img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("ImgLogo"); GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.logo), GT.Picture.PictureEncoding.JPEG); img.Bitmap = pic.MakeBitmap(); Glide.MainWindow = MainWindow; //MainWindow.Invalidate(); Thread.Sleep(2000); CallFormRequestEvent(ScreenTypes.MainMenu); }