public void get_tile(string options) { string callbackId; options = options.Replace("{}", ""); /// empty objects screw up the Deserializer try { /// z, x, y string[] args = JSON.JsonHelper.Deserialize <string[]>(options); /// to test maybe is not an integer but a JSONObject EntryTile entryTile = JSON.JsonHelper.Deserialize <EntryTile>(args[0]); int z = entryTile.z; int x = entryTile.x; int y = entryTile.y; callbackId = args[1]; if (mbTilesActions != null && mbTilesActions.isOpen()) { tiles_output tile = mbTilesActions.getTile(z, x, y); DispatchCommandResult(new PluginResult(PluginResult.Status.OK, tile), callbackId); } else { DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION), callbackId); } } catch (Exception) { DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); } }
public PeriodInfo GetPeriodInfo(Java.Util.Date p0, int p1) { var p = new PeriodInfoX(); var entries = Cache.GetEntryCache(DateTime.Now.Date); p.ShowEmptyListScreen = false; p.ShowNote = true; p.ShowTime = true; p.ShowTotals = true; p.Note = "Some note"; p.Time = "10:26 pm"; p.TotalLabel = "Total Calories"; p.TotalAmount = Cache.GetPeriodPropertyValue(DateTime.Now.Date, (Values.Period)p1, Values.StandardProperty.Calories).ToString(true); p.Entries = new List <EntryTile> (); foreach (var e in entries[p1]) { var t = new EntryTile() { Text = e.Text, Amount = e.TotalAmountText }; t.Properties = new List <PropertyTile> (); foreach (var prop in UserSettings.Current.SelectedProperties) { t.Properties.Add(new PropertyTile() { Text = prop.FullCapitalizedText, Amount = e.GetPropertyValue(prop).ValueString() }); } p.Entries.Add(t); } return(p); }