2012-07-05 38 views
1

在後臺代理中,我創建(或更新)應用程序實時磁貼之一,並按預期工作。
問題是,當我點擊這個活瓷磚屏幕閃爍但我的應用程序沒有「重新啓動」,也沒有「顯示」。
有什麼問題?
我附上一小部分的代碼,但要求更多是你需要的。點擊LiveTile不會顯示/運行我的應用程序

MAIN PAGE

public partial class MainPage : PhoneApplicationPage 
{ 
    protected override void OnNavigatedTo(NavigationEventArgs e) 
    { 
     base.OnNavigatedTo(e); 
    } 
    public MainPage() 
    { 
     InitializeComponent(); 

     // Runs background agent: code is simplified 
     StartAgent(); 
    } 
} 

後臺代理

public class TileAgent : ScheduledTaskAgent 
{ 
    protected override void OnInvoke(ScheduledTask task) 
    { 
     Deployment.Current.Dispatcher.BeginInvoke(() => 
     { 
      Vars.UpdateTiles(); 
     }); 

     NotifyComplete(); 
    } 
} 

靜態類

public class Vars 
{ 
    private static Uri uri = new Uri(
     "/MainPage.xaml?tile", 
     UriKind.RelativeOrAbsolute); 
    private static RadExtendedTileData ExtendedData 
    { 
     get 
     { 
      return new RadExtendedTileData() 
      { 
       VisualElement = frontTile, 
       BackVisualElement = backTile,      
      }; 
     } 
    } 

    public static void UpdateTiles() 
    { 
     // I perform some task here 

     // Then I create/update live tile 
     Telerik.Windows.Controls.LiveTileHelper.CreateOrUpdateTile(
      ExtendedData, uri); 
    } 
} 
+0

您是否嘗試過使用標準磁貼信息而不是Telerik? – 2012-07-05 15:49:34

+1

我沒有看到你開始你的應用程序的位置。 – 2012-07-05 15:53:04

+0

@ShawnKendrot:不,我需要Telerik,因爲它可以讓我創建自定義圖塊。 – Marco 2012-07-05 15:55:02

回答

3

嘗試/MainPage.xaml?tile=true而不是/MainPage.xaml?tile ...

並將NotifyComplete()移動到調度程序調用中。否則,它會在操作完成之前調用...

相關問題