Exemple #1
0
        private void BtnSearch_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Searched for city typed \\
                string city = txtSearch.Text;

                RestHandler objrest = new RestHandler();
                root    = objrest.ExecuteRequest(city);
                rootDay = objrest.ExecuteRequestCurrent(city);

                LoadHamilton();
                Image();
                LoadDay(1);
                LoadDay(2);
                LoadDay(3);
                LoadDay(4);
                LoadDay(5);
            }
            catch
            {
                Toast.MakeText(this, txtSearch.Text + " not found please try a larger town", ToastLength.Long).Show();
                return;
            }
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            txtSearch      = FindViewById <EditText>(Resource.Id.txtSearch);
            btnSearch      = FindViewById <Button>(Resource.Id.btnSearch);
            btnGPS         = FindViewById <Button>(Resource.Id.btnGPS);
            txtCity        = FindViewById <TextView>(Resource.Id.txtCity);
            txtMain        = FindViewById <TextView>(Resource.Id.txtMain);
            txtTemp        = FindViewById <TextView>(Resource.Id.txtTemp);
            imgMain        = FindViewById <ImageView>(Resource.Id.imgMain);
            txtDescription = FindViewById <TextView>(Resource.Id.txtDescription);
            imgDay1        = FindViewById <ImageView>(Resource.Id.imgDay1);
            imgDay2        = FindViewById <ImageView>(Resource.Id.imgDay2);
            imgDay3        = FindViewById <ImageView>(Resource.Id.imgDay3);
            imgDay4        = FindViewById <ImageView>(Resource.Id.imgDay4);
            imgDay5        = FindViewById <ImageView>(Resource.Id.imgDay5);
            txtDay1        = FindViewById <TextView>(Resource.Id.txtDay1);
            txtDay2        = FindViewById <TextView>(Resource.Id.txtDay2);
            txtDay3        = FindViewById <TextView>(Resource.Id.txtDay3);
            txtDay4        = FindViewById <TextView>(Resource.Id.txtDay4);
            txtDay5        = FindViewById <TextView>(Resource.Id.txtDay5);
            txtDetails1    = FindViewById <TextView>(Resource.Id.txtDetails1);
            txtDetails2    = FindViewById <TextView>(Resource.Id.txtDetails2);
            txtDetails3    = FindViewById <TextView>(Resource.Id.txtDetails3);
            txtDetails4    = FindViewById <TextView>(Resource.Id.txtDetails4);
            txtDetails5    = FindViewById <TextView>(Resource.Id.txtDetails5);


            btnGPS.Click          += BtnGPS_Click;
            btnSearch.Click       += BtnSearch_Click;
            txtSearch.TextChanged += TxtSearch_TextChanged;

            // Call Hamilton \\
            RestHandler objrest = new RestHandler();

            root    = objrest.ExecuteRequest("Hamilton");
            rootDay = objrest.ExecuteRequestCurrent("Hamilton");

            LoadHamilton();
            Image();

            // 5 Day forcast \\
            int[] imresid = { Resource.Id.imgDay1, Resource.Id.imgDay2, Resource.Id.imgDay3, Resource.Id.imgDay4, Resource.Id.imgDay5 };

            for (int i = 0; i < 5; i++)
            {
                img[i] = FindViewById <ImageView>(imresid[i]);
            }
            LoadDay(1);
            LoadDay(2);
            LoadDay(3);
            LoadDay(4);
            LoadDay(5);
        }