Esempio n. 1
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            #region InitilizeDB
            StefaniniContextAndroid db = new StefaniniContextAndroid();
            db.CreateDataBase();
            #endregion


            WeatherService weatherService = new WeatherService();
            var            resultSerivce  = weatherService.GetAll();
            if (resultSerivce != null && resultSerivce.Count > 0)
            {
                _weatherList = resultSerivce;
                #region Initilizar Itens View

                SetContentView(Resource.Layout.WeatherView);
                _lv          = FindViewById <ListView>(Resource.Id.lv);
                _sv          = FindViewById <SearchView>(Resource.Id.sv);
                _weatherList = new List <WeatherViewModel>();

                #endregion

                await GetJson();


                GetAdapter();

                _lv.Adapter = _newAdapter;

                #region Events

                _lv.ItemClick += _lv_ItemClick;

                _sv.QueryTextChange += _sv_QueryTextChange;

                #endregion
            }
            else
            {
                Toast.MakeText(this, "Voçê não possui cidade favorita, favor adicionar uma....", ToastLength.Short).Show();
                Intent setIntent = new Intent(this, typeof(CitiesView));
                StartActivity(setIntent);
            }
        }