Example #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);
                        }
                    }
                }
                                                                                                            );
            }
        }
Example #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);
                        }
                    }
                }
                                                                                                            );
            }
        }
Example #3
0
 private static bool DetectTrollCollision(Location locationToCompare)
 {
     if (Trolls.Any(x => x.Location.X == locationToCompare.X && x.Location.Y == locationToCompare.Y))
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 static void PutTrollsOnMaze()
 {
     Trolls.Clear();
     for (int i = 0; i < Settings.TrollCount.Value; i++)
     {
         Trolls.Add(new Troll(GetEntityLocationStart(MazeDefault)));
         MazeDefault.Map[Trolls[i].Location.X, Trolls[i].Location.Y] = Troll.DefaultChar;
     }
 }
Example #5
0
 public void Trolls_Disemvowel_ShouldRemoveAllVowels()
 {
     Assert.AreEqual(Trolls.Disemvowel("This website is for losers LOL!"),
                     "Ths wbst s fr lsrs LL!");
 }
Example #6
0
 public void Trolls_Disemvowel_OneMoreForGoodMeasure()
 {
     Assert.AreEqual(Trolls.Disemvowel("What are you, a communist?"),
                     "Wht r y,  cmmnst?");
 }
Example #7
0
 public void Trolls_Disemvowel_MultilineString()
 {
     Assert.AreEqual(Trolls.Disemvowel("No offense but,\nYour writing is among the worst I've ever read"),
                     "N ffns bt,\nYr wrtng s mng th wrst 'v vr rd");
 }
Example #8
0
 public string VisitTrolls(Trolls troll)
 {
     return("Trolls can't fly");
 }
Example #9
0
 public string VisitTrolls(Trolls troll)
 {
     return(troll.walk());
 }