Exemplo n.º 1
0
        public static async Task<RootObject> Get()
        {
            var serializer = new SimplyMobile.Text.ServiceStack.JsonSerializer ();

            var webClient = new JsonClient (serializer);

            var response = await webClient.GetAsync<RootObject>("http://www.reddit.com/r/all.json", Format.Json);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return response.Value;
            } 
            else
            {
                System.Diagnostics.Debug.WriteLine (response.Content);
            }

            var serializer2 = new SimplyMobile.Text.JsonNet.JsonSerializer ();

            webClient = new JsonClient(serializer2);

            response = await webClient.GetAsync<RootObject>("http://www.reddit.com/r/all.json", Format.Json);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return response.Value;
            } 
            else
            {
                System.Diagnostics.Debug.WriteLine (response.Content);
            }
            return null;
        }
Exemplo n.º 2
0
        public static async Task <RootObject> Get()
        {
            var serializer = new SimplyMobile.Text.ServiceStack.JsonSerializer();

            var webClient = new JsonClient(serializer);

            var response = await webClient.GetAsync <RootObject>("http://www.reddit.com/r/all.json", Format.Json);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(response.Value);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(response.Content);
            }

            var serializer2 = new SimplyMobile.Text.JsonNet.JsonSerializer();

            webClient = new JsonClient(serializer2);

            response = await webClient.GetAsync <RootObject>("http://www.reddit.com/r/all.json", Format.Json);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(response.Value);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(response.Content);
            }
            return(null);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.

            var filter = CreateFilter();

            if (filter != null)
            {
                System.Diagnostics.Debug.WriteLine(filter.ValueForKey(new NSString("inputCubeDimension")));
            }

            var serializer = new SimplyMobile.Text.JsonNet.JsonSerializer();

            var userResponse = serializer.Deserialize <ServiceResponse <TestUser> > (
                TestUser.DummyResponse);

            if (userResponse.Status == "SUCCESS")
            {
                System.Diagnostics.Debug.WriteLine(userResponse.Value.Id);
                System.Diagnostics.Debug.WriteLine(userResponse.Value.Name);
                System.Diagnostics.Debug.WriteLine(userResponse.Value.Number);
            }
        }
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            
            // Perform any additional setup after loading the view, typically from a nib.

            var filter = CreateFilter ();

            if (filter != null)
            {
                System.Diagnostics.Debug.WriteLine(filter.ValueForKey (new NSString ("inputCubeDimension")));
            }

            var serializer = new SimplyMobile.Text.JsonNet.JsonSerializer ();

            var userResponse = serializer.Deserialize<ServiceResponse<TestUser>> (
                TestUser.DummyResponse);

            if (userResponse.Status == "SUCCESS")
            {
                System.Diagnostics.Debug.WriteLine (userResponse.Value.Id);
                System.Diagnostics.Debug.WriteLine (userResponse.Value.Name);
                System.Diagnostics.Debug.WriteLine (userResponse.Value.Number);
            }
        }