Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Log.Verbose(Constants.LOGTAG, "MainActivity onCreate");

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

            var responseText = FindViewById <TextView>(Resource.Id.response);
            var statusText   = FindViewById <TextView>(Resource.Id.status);
            var button       = FindViewById <Button>(Resource.Id.MyButton);

            var weatherService = new Common.WeatherWebService.WeatherService();

            button.Click += (sender, args) =>
            {
                count++;
                statusText.Text   = string.Format("Requests Issued : {0}", count);
                responseText.Text = "Waiting for data";

                Log.Verbose(Constants.LOGTAG, "Calling Weather Web");
                System.Threading.ThreadPool.QueueUserWorkItem(delegate
                {
                    var forecast = weatherService.GetForecasts("60614");
                    RunOnUiThread(() => { responseText.Text = forecast.ToDisplayString(); });
                });
            };
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            Log.Verbose(Constants.LOGTAG, "MainActivity onCreate");

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

            var responseText = FindViewById<TextView>(Resource.Id.response);
            var statusText = FindViewById<TextView>(Resource.Id.status);
            var button = FindViewById<Button>(Resource.Id.MyButton);

            var weatherService = new Common.WeatherWebService.WeatherService();

            button.Click += (sender, args) =>
                                {
                                    count++;
                                    statusText.Text = string.Format("Requests Issued : {0}", count);
                                    responseText.Text = "Waiting for data";

                                    Log.Verbose(Constants.LOGTAG,"Calling Weather Web");
                                    System.Threading.ThreadPool.QueueUserWorkItem(delegate
                                                                     {
                                                                        var forecast = weatherService.GetForecasts("60614");
                                                                        RunOnUiThread(() =>{ responseText.Text = forecast.ToDisplayString(); });
                                                                     });
                                };
        }
Example #3
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);
            var weatherService = new Common.WeatherWebService.WeatherService();
            resultText.Text = "";
            countText.Text = "";

            button.TouchDown += (sender, e) => {
                countText.Text = string.Format("Requests made : {0}",++count);
                var forecasts = weatherService.GetForecasts("60614");
                resultText.Text = forecasts.ToDisplayString();
            };

            window.MakeKeyAndVisible ();

            return true;
        }
Example #4
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);
            var weatherService = new Common.WeatherWebService.WeatherService();

            resultText.Text = "";
            countText.Text  = "";

            button.TouchDown += (sender, e) => {
                countText.Text = string.Format("Requests made : {0}", ++count);
                var forecasts = weatherService.GetForecasts("60614");
                resultText.Text = forecasts.ToDisplayString();
            };

            window.MakeKeyAndVisible();

            return(true);
        }