Exemplo n.º 1
0
        private async void Update_Clicked(object sender, RoutedEventArgs e)
        {
            var checkResult = await UpdateMonitor.CheckUpdate(force : true);

            var progressIndicator = StatusBar.GetForCurrentView().ProgressIndicator;

            switch (checkResult)
            {
            case UpdateMonitor.Result.Found:
                IndicateUpdateAvailable();
                break;

            case UpdateMonitor.Result.NotFound:
                progressIndicator.Text          = App.Common.Services.Resources.LocalizedStringOf("MainProgressNoUpdate");
                progressIndicator.ProgressValue = 0.0;
                progressIndicator.ShowAsync();
                await Task.Delay(3000);

                progressIndicator.HideAsync();
                break;

            case UpdateMonitor.Result.NoAccess:
                progressIndicator.Text          = App.Common.Services.Resources.LocalizedStringOf("MainProgressNoInternet");
                progressIndicator.ProgressValue = 0.0;
                progressIndicator.ShowAsync();
                await Task.Delay(3000);

                progressIndicator.HideAsync();
                break;
            }
        }
Exemplo n.º 2
0
        private async void Update_Clicked(object sender, EventArgs e)
        {
            var checkResult = await UpdateMonitor.CheckUpdate(force : true);

            switch (checkResult)
            {
            case UpdateMonitor.Result.Found:
                IndicateUpdateAvailable();
                break;

            case UpdateMonitor.Result.NotFound:
                ProgressIndicator prog = new ProgressIndicator {
                    Text = AppResources.MainProgressNoUpdate, IsVisible = true
                };
                SystemTray.SetProgressIndicator(this, prog);
                await Task.Delay(3000);

                SystemTray.SetProgressIndicator(this, null);
                break;

            case UpdateMonitor.Result.NoAccess:
                ProgressIndicator prog1 = new ProgressIndicator {
                    Text = AppResources.MainProgressNoInternet, IsVisible = true
                };
                SystemTray.SetProgressIndicator(this, prog1);
                await Task.Delay(3000);

                SystemTray.SetProgressIndicator(this, null);
                break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected async override void OnInvoke(ScheduledTask task)
        {
            try
            {
                Config.Initialize();
                var services = new WPSilverlightCoreServices();
                var tb       = new TransitBase.TransitBaseComponent(
                    root: services.FileSystem.GetAppStorageRoot(),
                    directionsService: null,
                    preLoad: false,
                    bigTableLimit: Config.Current.BigTableLimit,
                    checkSameRoutes: Config.Current.CheckSameRoutes,
                    latitudeDegreeDistance: Config.Current.LatitudeDegreeDistance,
                    longitudeDegreeDistance: Config.Current.LongitudeDegreeDistance
                    );
                var ub     = new UserBase.UserBaseLinqToSQLComponent("Data Source=isostore:ddb.sdf", Config.Current.UBVersion, forbidMigration: true);
                var common = new CommonComponent(services, tb, ub);

                foreach (var tile in ShellTile.ActiveTiles)
                {
                    if (tile.NavigationUri.OriginalString.StartsWith("/MainPage.xaml?tile="))
                    {
                        if (tile.NavigationUri.OriginalString.StartsWith("/MainPage.xaml?tile=stoproute"))
                        {
                            updateTileUnknown(tile);
                        }
                        else
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                Tiles.UpdateTile(tile);
                                //bool ret = Tiles.UpdateTile(tile);
                                //if (ret == false)
                                //    updateTileUnknown(tile);
                                tb.Flush();
                            });
                        }
                    }
                }
                if (NetworkInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 && NetworkInterface.GetIsNetworkAvailable() && !AppFields.UpdateAvailable)
                {
                    var checkResult = await UpdateMonitor.CheckUpdate();

                    if (checkResult == UpdateMonitor.Result.Found)
                    {
                        ShellToast toast = new ShellToast();
                        toast.Title   = "Update";
                        toast.Content = "A database update is required.";
                        toast.Show();
                    }
                }
            }
            catch (Exception) { }


            NotifyComplete();
        }
Exemplo n.º 4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.NavigationMode == NavigationMode.New)
            {
                //adatbázis inicializálása első induláskor
                if (!App.TB.DatabaseExists || AppFields.ForceUpdate)
                {
                    await DatabaseDownloader.RunAsync();
                }

                ContentFrame.Navigate(typeof(DefaultPage));

                //frissítés keresése
                var checkUpdateResult = await UpdateMonitor.CheckUpdate();

                if (checkUpdateResult == UpdateMonitor.Result.Found)
                {
                    var dialog = new MessageDialog("A menetrend adatbázis elavult lehet.", "Frissítés elérhető");
                    dialog.Commands.Add(new UICommand {
                        Label = "Frissítés most", Id = true
                    });
                    dialog.Commands.Add(new UICommand {
                        Label = "Emlékeztessen később", Id = false
                    });
                    var res = await dialog.ShowAsync();

                    if ((bool)res.Id == true)
                    {
                        await DatabaseDownloader.RunAsync();

                        var finalDialog = new MessageDialog("A frissítés kész, kérem indítsa újra az alkalmazást.");
                        finalDialog.Commands.Add(new UICommand {
                            Label = "Rendben", Id = true
                        });
                        await finalDialog.ShowAsync();

                        throw new Exception("A frissítés kész, kérem indítsa újra az alkalmazást!");
                    }
                }

                //if (await ApplicationData.Current.LocalFolder.ContainsFileAsync("error.log"))
                //{
                //    var logFile = await ApplicationData.Current.LocalFolder.GetFileAsync("error.log");
                //    string logData;
                //    using (var logStream = await logFile.OpenStreamForReadAsync())
                //    {
                //        logData = new StreamReader(logStream).ReadToEnd();
                //    }
                //    new MessageDialog(logData).ShowAsync();
                //    await logFile.DeleteAsync();
                //}
            }
        }
Exemplo n.º 5
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();
                }
            }
        }
Exemplo n.º 6
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));
        }