Exemple #1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            _vkService = new VkService ();

            var param = new WallRequestParam {
                OwnerId = -32509740,
                Filter = FilterType.All,
            };

            _vkService.GetWall(param).ContinueWith(rT => {
                IList<Post> result = rT.Result;

                int i = 25;
            });

            window.MakeKeyAndVisible();

            return true;
        }
Exemple #2
0
        public Task<IList<Post>> GetWall(WallRequestParam param)
        {
            TrySetApiVersion(param);

            UriBuilder builder = new UriBuilder (WallGetBaseUrl);
            builder.Query = param.BuildQuery();

            Task<HttpResponseMessage> requestTask = _client.GetAsync(builder.Uri);

            return requestTask.ContinueWith(rTask => {

                HttpResponseMessage responce = rTask.Result;
                responce.EnsureSuccessStatusCode();

                return responce.Content.ReadAsStringAsync().ContinueWith(t => {
                    var postRootObject = JsonConvert.DeserializeObject<VkRootObject<Post>>(t.Result);
                    var result = postRootObject.response.items;
                    return (IList<Post>)result;
                });

            }).Unwrap();
        }