Exemple #1
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="navigationParameter">The parameter value passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
 /// </param>
 /// <param name="pageState">A dictionary of state preserved by this page during an earlier
 /// session.  This will be null the first time a page is visited.</param>
 protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
 {
     dataSource = (ActorMovieDataSource)App.Current.Resources["ActorMovieDataSource"];
     if (dataSource.AllGroups.Count > 0)
     {
         this.DefaultViewModel["Groups"] = dataSource.AllGroups;
     }
     else
     {
         var sampleDataGroups = dataSource.GetGroups((String)navigationParameter);
         this.DefaultViewModel["Groups"] = sampleDataGroups;
         SetupQuery();
     }
 }
Exemple #2
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public static void Update()
        {
            dataSource = new ActorMovieDataSource(); //Live tile lives in its own data world. To not interfere with GroupedItemsPage LoadAsync and add data twice.
            var serviceRoot = new Uri(ServiceConstants.ServiceRootUrl);

            data = new s.martinbeEntities(serviceRoot);
            //Example of lambda expression
            var query = (DataServiceQuery <s.Movie>)data.Movie.Expand("Actor").OrderBy(c => c.Title);

            movies = new DataServiceCollection <s.Movie>();

            //Use of delegate
            movies.LoadCompleted += movies_LoadCompleted;
            movies.LoadAsync(query);
        }