private void BuildButtons() { var btnSend = new StyledStringElement ("Send to Office"); btnSend.TextColor = ColorHelper.GetGPLightPurple (); btnSend.Tapped += delegate { //test if (isBusy) { Busy (); return; } var note = new MatterNoteDTO (); if (picker != null) { picker.TimeZone = NSTimeZone.DefaultTimeZone; DateTime dt = DateTime.Now; Console.WriteLine ("----> PostNote picker local date: " + dt.ToString ()); note.date = Tools.ConvertDateTimeToJavaMS (dt); } note.matterID = Convert.ToInt16 (matter.id); if (narration.Value.Trim () == "") { new UIAlertView ("Narration", "Please enter Note narration", null, "OK").Show (); return; } note.narration = narration.Value; note.tariffCodeID = selectedTariff.id; PostNoteToOffice (note); }; btnSend.Alignment = UITextAlignment.Center; narrationSection.Add (btnSend); }
/* * Methods to access web services async * */ public void PostNoteToOffice(MatterNoteDTO note) { if (isBusy) { Console.WriteLine ("##PostNote: comms are busy, slow down!"); return; } isBusy = true; BuildInterface (); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; start = DateTime.Now; GhostRequestDTO cr = new GhostRequestDTO (); string json, encodedJSON, url; cr.requestType = GhostRequestDTO.POST_NOTE; cr.note = note; cr.appID = NSUserDefaults.StandardUserDefaults.IntForKey ("appID"); cr.userID = NSUserDefaults.StandardUserDefaults.IntForKey ("userID"); cr.companyID = NSUserDefaults.StandardUserDefaults.IntForKey ("companyID"); cr.deviceID = NSUserDefaults.StandardUserDefaults.StringForKey ("deviceID"); json = JsonConvert.SerializeObject (cr); Console.WriteLine ("@@ PostNote JSON = " + json); encodedJSON = HttpUtility.UrlEncode (json); url = Tools.CONSOLE_URL + encodedJSON; var request = (HttpWebRequest)WebRequest.Create (url); request.BeginGetResponse (PostComplete, request); }