1

I've added a ScheduledTaskAgent project affiliated with my WP8 project - I added a reference in the WP8 project to the ScheduledTaskAgent project. In the ScheduledTaskAgent project's OnInvoke() code, I want to query a WAMS table that is already defined in the WP8 project. The WAMS code is "greek" to the ScheduledTaskAgent project. IOW, this is not recognized by it:

   protected override void OnInvoke(ScheduledTask task)
   {
                IMobileServiceTable<WAMS_INVITATIONS> table =     
    app.MobileService.GetTable<WAMS_INVITATIONS>();    
                MobileServiceTableQuery<String> query = <bla>;
                return await query.ToListAsync();
                . . .
    }

...which is not at all surprising, because "app" is the other project's App.xaml.cs class, and WAMS_INVITATIONS is the class in the other project that defines the table to be queried. So...is it okay for a ScheduledTaskAgent project to add a reference back to the foreground project that references it, or will this circular reference cause problems? Otherwise, I need to copy over the MobileService declaration from App.xaml.cs and the table definition class from the foreground project?

I made IMobileServiceTable understandable to the compiler by adding a reference to "Windows Azure Mobile Services Managed Client" to the ScheduledTaskAgent project.

4

1 に答える 1

2

kindasimple's answer is correct, however once you successfully get your agent building, it's likely you will hit a known issue: the current Mobile Services SDK cannot be used in background tasks on Windows Phone. The SDK makes references to UI components and your app may not pass certification due to that. We are aware of the problem and working on a fix, just wanted to give you a heads up.

于 2013-02-01T01:25:26.493 に答える