public override void Init(params string[] Param) { MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.InboxForm)); //populate inbox data PopulateList(); ArrayList control = new ArrayList(); txtMessage = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtMessage"); txtReply = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtReply"); txtNoReply = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtNoReply"); txtMessage.TapEvent += new OnTap(Glide.OpenKeyboard); txtReply.TapEvent += new OnTap(Glide.OpenKeyboard); txtNoReply.TapEvent += new OnTap(Glide.OpenKeyboard); listMessage.CloseEvent += (object sender) => { Glide.CloseList(); }; cmbInbox = (GHI.Glide.UI.Dropdown)MainWindow.GetChildByName("cmbInbox"); cmbInbox.TapEvent += (object sender) => { Glide.OpenList(sender, listMessage); }; cmbInbox.ValueChangedEvent += (object sender) => { var dropdown = (GHI.Glide.UI.Dropdown)sender; if (dropdown.Value == null) return; var data = sdCard.StorageDevice.ReadFile(dropdown.Value.ToString()); txtMessage.Text = new string(Encoding.UTF8.GetChars(data)); txtMessage.Invalidate(); //Debug.Print("Dropdown value: " + dropdown.Text + " : " + dropdown.Value.ToString()); }; var BtnBack = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnBack"); control.Add(BtnBack); BtnBack.PressEvent += (sender) => { CallFormRequestEvent(ScreenTypes.MainMenu); }; var btnSend = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnSend"); control.Add(btnSend); btnSend.PressEvent += (sender) => { //send sms... if (txtNoReply.Text.Length > 0 && txtReply.Text.Length > 0) { cellularRadio.SendSms(txtNoReply.Text, txtReply.Text); Glide.MessageBoxManager.Show("Message sent."); } }; var btnClear = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnClear"); control.Add(btnClear); btnClear.PressEvent += (sender) => { txtReply.Text = string.Empty; txtReply.Invalidate(); }; Glide.MainWindow = MainWindow; //MainWindow.Invalidate(); }
public override void Init(params string[] Param) { MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.RegisterForm)); ArrayList control = new ArrayList(); FileUrl = Param[0]; var ImgPhoto = (GHI.Glide.UI.Image)MainWindow.GetChildByName("ImgPhoto"); //load image if (sdCard.IsCardInserted && sdCard.IsCardMounted) { var storage = sdCard.StorageDevice; Bitmap bitmap = storage.LoadBitmap(FileUrl, Bitmap.BitmapImageType.Jpeg); ImgPhoto.Bitmap = bitmap; ImgPhoto.Invalidate(); } txtNama = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtNama"); txtEmail = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtEmail"); txtTwitter = (GHI.Glide.UI.TextBox)MainWindow.GetChildByName("txtTwitter"); txtNama.TapEvent += new OnTap(Glide.OpenKeyboard); txtEmail.TapEvent += new OnTap(Glide.OpenKeyboard); txtTwitter.TapEvent += new OnTap(Glide.OpenKeyboard); var btnCancel = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnCancel"); control.Add(btnCancel); btnCancel.PressEvent += (sender) => { CallFormRequestEvent(ScreenTypes.Gallery); }; var btnSubmit = (GHI.Glide.UI.Button)MainWindow.GetChildByName("btnSubmit"); control.Add(btnSubmit); btnSubmit.PressEvent += (sender) => { if (wifiRS21.IsNetworkConnected) { var storage = sdCard.StorageDevice; // Create the form values var FileData = sdCard.StorageDevice.ReadFile(FileUrl); var qry = "?nama=" + txtNama.Text + "&email=" + txtEmail.Text + "&twitter=" + txtTwitter.Text; // Create POST content var content = Gadgeteer.Networking.POSTContent.CreateBinaryBasedContent(FileData); // Create the request var request = Gadgeteer.Networking.HttpHelper.CreateHttpPostRequest( @"http://192.168.1.102:8001/api/upload.ashx" + qry // the URL to post to , content // the form values , "image/jpeg" // the mime type for an HTTP form ); request.ResponseReceived += (HttpRequest s, HttpResponse response) => { if (response.StatusCode == "200") Glide.MessageBoxManager.Show("File uploaded successfully.", "Info"); //var xx = response.Text; }; // Post the form request.SendRequest(); } }; Glide.MainWindow = MainWindow; //MainWindow.Invalidate(); }