0
votes

I am trying to use live tiles with periodictask background agent. My scenario is I have to get images from medialibrary and then save into Isolated storage some images upto nine number of images as cyclic tile supports max nine images. I have added periodic agent project in my solution and referred into my main Project. In my main project I am registering my periodic task and starting that tasks. But rest of invocation and implementation is done Schedule Agent. I have to get some images from my main Project for tile creation. When I try to add main project reference to my Scheduling agent project then it says "You have circular dependency" You cannot add reference. Can Anyone please help me How I can get my bussiness logic of My Main Project In My Schedule Task Project.

=== Edit ===

Let's Say I Have First Main Project Called HelloWorld And It Doing Some Operations And Saving Some Images In Isolated Storage And Count Of Unread Messages In Isloated Storage. Now I Have Second Project For Scheduling Agent And Its Refereed In My Main Project "HelloWorld" And I Am Registering My Scheduling Agents And Starting Them In My Main Project "HelloWorld". But The Rest Part Of Invocation is in Scheduling Agent.

protected override void OnInvoke(ScheduledTask task)
{
 StandardTileData data = new StandardTileData

 {

 Title = "My tile!",

 Count = 10, // I Need To Get This Counter From Isolated Storage Or My Other main Project

 BackgroundImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute),

 BackTitle = "This is the back",

 BackContent = "Hallo!",

 BackBackgroundImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute)
 };

ShellTile.ActiveTiles.First().Update(data);
  // If debugging is enabled, launch the agent again in one minute.
#if DEBUG_AGENT
  ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
#endif

  // Call NotifyComplete to let the system know the agent is done working.
  NotifyComplete();
}

Let say as per Igor suggestion I create some third class library project then I Will Write one method there that will fetch information from My Main Project And I Will Refer My Main Project in This third Class Library Project. Then If I Call This Class Library In Scheduling Project and Again It Says Me You Have Circular Dependency. Please Tell Me How To Accomplish

1

1 Answers

0
votes

Extract the business logic to a third library class project and reference it from both Main Project and Schedule Task Project