示例#1
0
        public async void SyncApplication()
        {
            await instinct.ReadMap();

            instinct.PostError("App Restarted");

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                while (true)
                {
                    if (instinct.isUpdated() == true)
                    {
                        // Refresh App
                        ScreenContent.Content = frame;
                        frame.Navigate(typeof(LandingPage), null, new SuppressNavigationTransitionInfo());
                    }

                    await Task.Delay(5000); // Freq

                    // Set Fullscreen
                    ApplicationView view = ApplicationView.GetForCurrentView();
                    view.TryEnterFullScreenMode();


                    var progress = new Progress <string>(status =>
                    {
                        if (status == "Sync: Checking version... update required.")
                        {
                            ScreenContent.Content = frame;
                            frame.Navigate(typeof(UpdatingPage), null, new SuppressNavigationTransitionInfo());
                        }

                        UpdateUI(status);
                    });
                    try
                    {
                        await instinct.SyncApplication(progress);
                    }
                    catch
                    {
                        UpdateUI("Sync: Error syncing application - check HTTP response.");
                    }
                    //UpdateUI("Version ID: " + )
                }
            });
        }