Example #1
0
        public async Task <ReturnObject> GetMonster(int number = -1)
        {
            ReturnObject ReturnObject;

            MonsterList ml;

            Request.Monster.Monsters monsters = new Request.Monster.Monsters();
            monsters.SetParam();
            if (App.core.Offline)
            {
                return new ReturnObject()
                       {
                           Content   = MonsterList.GetMonsterListFromJson(null, 30),
                           ErrorCode = 0,
                           Message   = string.Empty
                       }
            }
            ;
            try
            {
                ml = MonsterList.GetMonsterListFromJson(await monsters.GetJsonAsync());

                ReturnObject = new ReturnObject()
                {
                    Content = ml, ErrorCode = 0, Message = string.Empty
                };
            }
            catch (HttpRequestException HRException)
            {
                Debug.WriteLine(HRException);
                ReturnObject = new ReturnObject()
                {
                    Content = null, ErrorCode = HRException.HResult, Message = "HttpRequestException : " + HRException.Message
                };
            }
            catch (Newtonsoft.Json.JsonException jEx)
            {
                Debug.WriteLine(jEx);
                ReturnObject = new ReturnObject()
                {
                    Content = null, ErrorCode = jEx.HResult, Message = "JsonException : " + jEx.Message
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                ReturnObject = new ReturnObject()
                {
                    Content = null, ErrorCode = ex.HResult, Message = "Exception : " + ex.Message
                };
            }
            return(ReturnObject);
        }
Example #2
0
 public void Init()
 {
     Add(new Area("Guadalajara", "http://allaboutguadalajara.com/wp-content/uploads/Guad_Main.jpg",
                  GenerateGeoPoint(
                      new BasicGeoposition
     {
         Latitude  = 20.733433,
         Longitude = -103.4582296
     },
                      new BasicGeoposition
     {
         Latitude  = 20.681559,
         Longitude = -103.3247552,
     },
                      new BasicGeoposition
     {
         Latitude  = 20.6748909,
         Longitude = -103.3574124,
     }
                      ),
                  GenerateItemList(new Model.Item("flower", 0, "desc", "ms-appx:///Assets/Flower/flowerFire.png", 0, 0, 0, 0), new Model.Item("flower", 0, "desc", "ms-appx:///Assets/Flower/flowerFire.png", 0, 0, 0, 0), new Model.Item("flower", 0, "desc", "ms-appx:///Assets/Flower/flowerFire.png", 0, 0, 0, 0)),
                  MonsterList.GetMonsterListFromJson(null)));
 }