예제 #1
0
        protected override async void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                if (!App.AppEnabled)
                {
                    MessageBox.Show("Your trial period has expired. You cannot use the app until you buy the full version.");
                    App.Current.Terminate();
                }

                //InitializerProcess.SendStatisctics();

                if (!App.DatabaseExists() || AppFields.ForceUpdate)
                {
                    var downloadResult = await DownloadDBDialog.Show();

                    DownloadDone(downloadResult);
                }
                if (InitializerProcess.FirstRun)
                {
                    await ShowLocationConsentBox();
                }
                FavoritesTab.SetContent();
                contentSetterTask = new PeriodicTask(updateContent);
                contentSetterTask.RunEveryMinute();

                string tile;
                if (NavigationContext.QueryString.TryGetValue("tile", out tile) && !tile.StartsWith("stoproute"))
                {
                    IRouteStopPair pair = App.UB.TileRegister.Get(Int32.Parse(tile));
                    if (pair != null)
                    {
                        NavigateToRouteStopPage(this, pair.Route, pair.Stop);
                    }
                }

                var checkUpdateResult = await UpdateMonitor.CheckUpdate();

                if (checkUpdateResult == UpdateMonitor.Result.Found)
                {
                    IndicateUpdateAvailable();
                }
            }
            else
            {
                FavoritesTab.SetContent();
                if (contentSetterTask != null)
                {
                    contentSetterTask.Resume();
                }
            }
        }
예제 #2
0
        public async void InitializePageState(object parameter)
        {
            if (!App.GetAppInfo().IsEnabled())
            {
                await new MessageDialog("Your trial period has expired. You cannot use the app until you buy the full version.").ShowAsync();
                App.Current.Exit();
            }

            InitializerProcess.SendStatisctics();
            Logging.Upload();

            if (!App.TB.DatabaseExists || AppFields.ForceUpdate)
            {
                var downloadResult = await DownloadDBDialog.Show();
                await DownloadDone(downloadResult, true);
            }
            if (InitializerProcess.FirstRun)
            {
                await ShowLocationConsentBox();
            }
            FavoritesPart.SetContent();
            stateManager.ScheduleTaskEveryMinute(updateContent);

            //if (App.SourceTileId != null)
            //{
            //    NavigateToTile(App.SourceTileId.Value);
            //}

            var checkUpdateResult = await UpdateMonitor.CheckUpdate();

            if (checkUpdateResult == UpdateMonitor.Result.Found)
            {
                IndicateUpdateAvailable();
            }

            //await Task.Delay(1000);
            //Frame.Navigate(typeof(TestPage));
        }
예제 #3
0
        private async void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            var downloadResult = await DownloadDBDialog.Show();

            DownloadDone(downloadResult);
        }