public void GetHubCompositionsAsync()
        {
            DataServiceRepository<Composer.Repository.DataService.Composition> repository =
            new DataServiceRepository<Composer.Repository.DataService.Composition>();

            DataServiceQuery<Composer.Repository.DataService.Composition> qry =
                repository.RetrieveAll<Composer.Repository.DataService.Composition>()
                as DataServiceQuery<Composer.Repository.DataService.Composition>;

            qry = qry.Expand(composition =>
                composition.Verses);

            qry = qry.Expand(composition =>
                composition.Collaborations);

            qry.BeginExecute(new AsyncCallback(a =>
            {
                try
                {
                    IEnumerable<Composer.Repository.DataService.Composition> results = qry.EndExecute(a);
                    if (HubCompositionsLoadingComplete != null)
                    {
                        HubCompositionsLoadingComplete(this, new HubCompositionsLoadingEventArgs(results));
                    }
                }
                catch (Exception ex)
                {
                    if (HubCompositionsLoadingError != null)
                    {
                        HubCompositionsLoadingError(this, new HubCompositionsErrorEventArgs(ex));
                    }
                }
            }), null);
        }
Beispiel #2
0
        public void GetCompositionAsync()
        {
            DataServiceRepository<Composer.Repository.DataService.Composition> repository =
            new DataServiceRepository<Composer.Repository.DataService.Composition>();
            Guid guid;
            Guid.TryParse(this.CompositionId, out guid);

            DataServiceQuery<Composer.Repository.DataService.Composition> qry =
                repository.RetrieveAll<Composer.Repository.DataService.Composition>().Where(c => c.Id == guid)
                as DataServiceQuery<Composer.Repository.DataService.Composition>;

            qry = qry.Expand(composition =>
                composition.Staffgroups.SubExpand(staffgroup =>
                    staffgroup.Staffs.SubExpand(staff =>
                        staff.Measures).SubExpand(measure =>
                            measure.Chords).SubExpand(chord =>
                                chord.Notes)));

            qry = qry.Expand(composition =>
                composition.Verses);

            qry = qry.Expand(composition =>
                composition.Collaborations);

            qry = qry.Expand(composition =>
                  composition.Arcs);

            qry.BeginExecute(new AsyncCallback(a =>
            {
                try
                {
                    IEnumerable<Composer.Repository.DataService.Composition> results = qry.EndExecute(a);

                    if (CompositionLoadingComplete != null)
                    {
                        CompositionLoadingComplete(this, new CompositionLoadingEventArgs(results));
                    }
                }
                catch (Exception ex)
                {
                    if (CompositionLoadingError != null)
                    {
                        CompositionLoadingError(this, new CompositionErrorEventArgs(ex));
                    }
                }
            }), null);
        }