Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Update ListView on WillEnterForeground

$
0
0

Objective

Update a Xamarin.Forms ListView when the iOS Application Enters the foreground

Approach

The closes example I have seen is found in the monotouch samples

https://github.com/xamarin/monotouch-samples/blob/master/SimpleBackgroundFetch/SimpleBackgroundFetch/AppDelegate.cs

public override void PerformFetch (UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
        {
            UINavigationController navigationController = Window.RootViewController as UINavigationController;
            UIViewController topViewController = navigationController.TopViewController;
            if (topViewController is RootViewController) {
                (topViewController as RootViewController).InsertNewObjectForFetch (completionHandler);
                UIApplication.SharedApplication.ApplicationIconBadgeNumber++;
            } else
                completionHandler (UIBackgroundFetchResult.Failed);
        }

This is using PerformFetch but the WillEnterForegroundMethod will accomplish what I am trying to do.

Problem

The problem is I am using a Xamarin.Form Page and don't know how to get access to the Page or the Pages' ViewModel from the App Delegate Class. Any ideas?


Viewing all articles
Browse latest Browse all 58056

Trending Articles