public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Code to start the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
#endif

            // Perform any additional setup after loading the view, typically from a nib.
            Button.AccessibilityIdentifier = "myButton";
            Button.TouchUpInside          += async delegate
            {
                string responseString      = "";
                var    httpConnectionProxy = new CMPHttpConnectionProxy();
                httpConnectionProxy.URL("http://www.google.com").Build();

                var httpResponse = await httpConnectionProxy.GetAsync();

                Console.WriteLine(httpResponse.ResponseString);

                await cl.GetBytesWithProgressAsync((httpResponse, progressBytes, totalBytes) =>
                {
                    responseString = string.Concat(responseString, httpResponse.ResponseString);
                    Console.WriteLine("Response:" + responseString);
                    Console.WriteLine("progressBytes: " + progressBytes + "\ntotalBytes: " + totalBytes);
                }); await cl.GetBytesWithProgressAsync((httpResponse, progressBytes, totalBytes) =>
                {
                    responseString = string.Concat(responseString, httpResponse.ResponseString);
                    Console.WriteLine("Response:" + responseString);
                    Console.WriteLine("progressBytes: " + progressBytes + "\ntotalBytes: " + totalBytes);
                });
            };
        }
示例#2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            string responseString = "";

            button.Click += async delegate
            {
                button.Text = string.Format("{0} clicks!", count++);

                CMPHttpConnectionProxy cl = new CMPHttpConnectionProxy();
                cl.URL("http://www.google.com").Build();
                await cl.GetBytesWithProgressAsync((httpResponse, progressBytes, totalBytes) =>
                {
                    responseString = string.Concat(responseString, httpResponse.ResponseString);
                    Console.WriteLine("Response:" + responseString);
                    Console.WriteLine("progressBytes: " + progressBytes + "\ntotalBytes: " + totalBytes);
                });
            };
        }
示例#3
0
 public CMPTextAnalytics(string apiRegionString, string apiKeyString)
 {
     _apiRegionString     = string.Copy(apiRegionString);
     _apiKeyString        = string.Copy(apiKeyString);
     _httpConnectionProxy = new CMPHttpConnectionProxy();
     _httpConnectionProxy.Headers(KSubscriptionKeyString, _apiKeyString);
 }
示例#4
0
 public CMPBaseShareService(string customerKeyString, string customerSecretKeyString)
 {
     _customerKeyString       = string.Copy(customerKeyString);
     _customerSecretKeyString = string.Copy(customerSecretKeyString);
     _httpConnectionProxy     = new CMPHttpConnectionProxy();
 }