Exemplo n.º 1
0
 // Network call completed
 private void callback(JSONObject result) {
     if (final == null) {
         // Create Result container
         final = new SuperCookResult();
         final.total_can_make_right_now = int.Parse(result.GetField("total_can_make_right_now").ToString());
         final.results = new List<SuperCookRecipe>();
     }
     // Convert results
     JSONArray arr = JSON.Parse(result.GetField("results").ToString()).AsArray;
     foreach (JSONNode jn in arr) {
         SuperCookRecipe scRecipe = new SuperCookRecipe();
         scRecipe.title = jn["title"];
         scRecipe.url = jn["url"];
         scRecipe.uses = jn["uses"];
         scRecipe.id = jn["id"].AsInt;
         final.results.Add(scRecipe);
     }
     if (final.results.Count >= final.total_can_make_right_now)
         finished(final);
     else
     {
         skip += 40;
         getRecipes(ingredients, finished);
     }
 }
Exemplo n.º 2
0
 void callback(SuperCookResult result)
 {
     this.result = result;
     index = 0;
     draw();
 }