Exemplo n.º 1
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (!isLoaded)
            {
                Constant.Loader(this.resourceLoader.GetString("GlobalLoading"), true);
                this.DefaultViewModel["Title"] = "Route";
                await Task.Run(() => LoadRoute());

                isLoaded = true;
                Constant.Loader(this.resourceLoader.GetString("GlobalLoadingSuccess"), false);
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                            async() =>
                {
                    while (true)
                    {
                        await Task.Delay(10000);
                        foreach (var item in Buses)
                        {
                            Buses.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                        foreach (var item in Trolls)
                        {
                            Trolls.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                        foreach (var item in Tramms)
                        {
                            Tramms.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                    }
                }
                                                                                                            );
            }
        }
Exemplo n.º 2
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (!isLoaded)
            {
                Constant.Loader(this.resourceLoader.GetString("GlobalLoading"), true);
                param = JsonConvert.DeserializeObject <StopNameAllSQL>(e.NavigationParameter.ToString());
                this.DefaultViewModel["Title"]    = param.name;
                this.DefaultViewModel["Favorite"] = Database.IfAllStopsAreFavorite(Int32.Parse(param.id)) ? Constant.FavoriteStar : Constant.UnFavoriteStar;
                await Task.Run(() => LoadRoutes(param));

                isLoaded = true;
                Constant.Loader(this.resourceLoader.GetString("GlobalLoadingSuccess"), false);
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                            async() =>
                {
                    while (true)
                    {
                        await Task.Delay(10000);
                        foreach (var item in Buses)
                        {
                            Buses.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                        foreach (var item in Trolls)
                        {
                            Trolls.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                        foreach (var item in Tramms)
                        {
                            Tramms.Where(d => d.d_id == item.d_id).First().Next_Bus = time.getNextBusTime(item.schedule, item.days);
                        }
                    }
                }
                                                                                                            );
            }
        }