如何在Web服务中更新Windows Phone 8的磁贴通知?

时间:2013-03-04 02:07:02

标签: c# windows-phone-8

我开发了一个应用程序,它可以获取webservice中的发票数量,并且每隔2分钟就会在磁贴通知中更新。发票号将在scheduledAgent.cs的count变量中更新。有什么想法吗?

在主页

ServiceReference1.WebServiceSoapClient test = new ServiceReference1.WebServiceSoapClient();

test.ReadTotalOutstandingInvoiceCompleted += new EventHandler<ServiceReference1.ReadTotalOutstandingInvoiceCompletedEventArgs>(serviceClient);

test.ReadTotalOutstandingInvoiceAsync();


private void serviceClient(object sender, ReadTotalOutstandingInvoiceCompletedEventArgs e)
{
     try
     {
         PeriodicTask p = new PeriodicTask("jj");

         p.Description = "Don't push the red button";

         ScheduledActionService.Add(p);

         ScheduledActionService.LaunchForTest(p.Name, TimeSpan.FromSeconds(10));
     }

     catch(Exception ex)
     {

     }
}

在ScheduledAgent.cs

 protected override void OnInvoke(ScheduledTask task)
    {
         //TODO: Add code to perform your task in background
         ShellTile t = ShellTile.ActiveTiles.First();

         StandardTileData d = new StandardTileData()
         {
             Title = "asdasdad",

             BackTitle = "cxvxvxvxcv",

             Count = 42,

             BackBackgroundImage = new Uri("dog.jpg", UriKind.Relative),

             BackgroundImage = new Uri("untitled.png", UriKind.Relative)
         };
             t.Update(d);

             NotifyComplete();

    }

0 个答案:

没有答案