public async void WidgetPerformUpdate(Action <NCUpdateResult> completionHandler)
        {
            // Perform any setup necessary in order to update the view.

            // If an error is encoutered, use NCUpdateResultFailed
            // If there's no update required, use NCUpdateResultNoData
            // If there's an update, use NCUpdateResultNewData
            eventTitle.Text       = string.Empty;
            eventDescription.Text = string.Empty;

            try
            {
                var locationManager = new CoreLocation.CLLocationManager();
                var location        = locationManager.Location;

                var service = new ReactorToday.Shared.Services.EventsService();
                var events  = await service.GetTodaysEventsAsync();

                var firstEvent = events.FirstOrDefault();

                eventTitle.Text       = firstEvent.Title;
                eventDescription.Text = firstEvent.EventDescription;

                completionHandler(NCUpdateResult.NewData);
            }
            catch (Exception)
            {
                eventTitle.Text = "I'm sorry I've croaked.";
                completionHandler(NCUpdateResult.Failed);
            }
        }
    public override void ViewDidLoad()
    {
      base.ViewDidLoad();
      viewModel = new WelcomeViewModel();
     

      var refresh = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (sender, args) =>
      {
        LoadData();
      });
      NavigationItem.RightBarButtonItem = refresh;

      TableView.Source = dataSource = new DataSource(this);
      LoadData();

			var location = new CoreLocation.CLLocationManager ();
			location.RequestWhenInUseAuthorization ();
    }
Esempio n. 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            viewModel = new WelcomeViewModel();


            var refresh = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (sender, args) =>
            {
                LoadData();
            });

            NavigationItem.RightBarButtonItem = refresh;

            TableView.Source = dataSource = new DataSource(this);
            LoadData();

            var location = new CoreLocation.CLLocationManager();

            location.RequestWhenInUseAuthorization();
        }