c# - ScheduledTaskAgent not working for updating tiles in Windows Phone -
I am working on a Windows Phone 7 app and try to implement features such as detailed tiles of Windows 8 phones I am doing I had achieved it with reflection, but when I wanted to update the tile using a scheduled agent for a periodic task, the tile is not ready.
Scheduled Agent OnInvoke Code looks like this
Protected Override Zero Onewoke (Scheduled Task Jobs) {// TODO: Add code to complete your work in the background ( Work is Periodic Task) {// Scheduled Task UpdateTileForWindowsPhone.CreateWideTile () Update the tile; } NotifyComplete (); } I created the tile using this code
public class CreateTileForWindowsPhone {Private Stable Version Targeted Version = New Version (7, 10, 8858); Public Static Bull iitized warsen {met {return environment. OSVERSION.Version & gt; = Targeted version; }} Public Static Zero CreateWideTile () {if (IsTargetedVersion) {try {// Get New FlipTileData Type Type FlipTilData Type = Type Gettype ("Microsoft.phone Shell.FlipTilData, Microsoft Phone"); Get the // Sheltile type so that we can call the new version of "update" which takes new tile templates. Type shellTileType = Type.GetType ("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone"); // Loop through an existing tile pinned to start. Excerpt: collection aq = new quotation (); Random rand = new random (); Int randNum = rand.Next (0, 163); // String Widebasket = "Do not be so, stay better."; String wydblackstat = aq.quotes [random]; Foreach (var tile setup in lion tile. Active tiles) {// Get the Constructor for the new FlipTyData class and place it in our variable to keep the tile properties Var updated tile data = flipTileDataType.NetConstructor (new type [] {} ). Call (empty); // Set property Setproperty (updated tile data, "widebacker image", new urie ("/ images / quottedWideTile.png", Uricund.relevetic)); Setproperty (updated tile data, "wide content", WideBlack SRR); // Open a new version of Shelltile. Update ShelltailTypeGetMath ("Update"). (TileUpupdate, New Object [] {Update Tiled Data}); break; }} Hold {Messagebox.Show ("caught tile error"); }}} Private Static Zero SetProperty (object example, string name, object value) {var setMethod = instance.GetType (). GetProperty (name) .GetSetMethod (); SetMethod.Invoke (example, new object [] {value}); }} I have created a register agent method to register periodic work
Private Zero RegisterAgent () {string taskName = "MyTask"; {If (ScheduledActionService.Find (taskName)! = Null) {// If the agent is present, remove it and add it to ensure / / Agent's scheduled expiry Update to avoid ScheduledActionService.Remove (taskName) has been done; } Periodic Task Periodic Task = New Periodic Task (Action Name); Periodic Task Description = "Random price updates on tile"; ScheduledActionService.Add (periodicTask); } Hold (invalid operation exception exception) {message box. Show (Exception Message); } Cache (SchedulerAccess Exception Scheduler Expansion) {Message Box. Show (scheduler expression.); }} and the register was called in the app launch
Private Zero Application_Living (Object Sender, Launching Event Egages E) {Register Agent (); } But when I run the app, a detailed tile is not being created to update tile I used to use extensive tile construction before using scheduled agents used to go. I had used that function to create a detailed tile by calling the function in the launch.
Private Zero Application_Living (Object Sender, Launching Dagger E) {CreateTileForWindowsPhone.CreateWideTile (); } Why the tile is not being made, am I doing something wrong?
deployment. Present. Dispatch. CreateTileForWindowsPhone.CreateWideTile;
Comments
Post a Comment