Exemplo n.º 1
0
        public void EnsureSeedDataExists()
        {
            if (Restaurants.Any())
            {
                return;
            }

            var sampleRestaurants = new List <Restaurant>
            {
                new Restaurant {
                    Name = "Scott's Pizza", Location = "Maryland", Cuisine = CuisineType.Italian
                },
                new Restaurant {
                    Name = "Joe's Mexican Restaurant", Location = "Texas", Cuisine = CuisineType.Mexican
                },
                new Restaurant {
                    Name = "Jeffrey's Lounge", Location = "Manitoba", Cuisine = CuisineType.Comfort
                },
                new Restaurant {
                    Name = "Clay Oven", Location = "Manitoba", Cuisine = CuisineType.Indian
                }
            };

            Restaurants.AddRange(sampleRestaurants);
            SaveChanges();
        }
Exemplo n.º 2
0
 public MainPageViewModel()
 {
     if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         Restaurants.AddRange(Enumerable.Range(1, 10).Select(x => new Restaurant(x)));
     }
     else
     {
         _dataService     = new Services.DataService();
         PropertyChanged += async(s, e) =>
         {
             _cancellationTokens.ForEach(x => x.Cancel());
             await SearchAsync();
         };
     }
 }