2012-12-08 77 views
0

我正在開發一個適用於Windows 8的簡單應用程序。在我的應用程序中,我希望啓動磁貼顯示來自本地主機的圖像,該圖像與我的應用程序一起提供。例如 例如我已經將圖像保存在/images/tile1.jpg中,就像明智一樣。 和我的XML代碼來自localhost的Windows 8磁貼通知

<tile> 
<visual> 
    <binding template="TileWideImage"> 
     <image id="1" src ="http://localhost/images/tile1.jpg" /> 
    </binding> 
</visual> 

這是目前在/tile1.xml同樣

和我default.js代碼

// For an introduction to the Blank template, see the following documentation: 
// http://go.microsoft.com/fwlink/?LinkId=232509 
(function() { 
    "use strict"; 

    WinJS.Binding.optimizeBindingReferences = true; 

    var app = WinJS.Application; 
    var activation = Windows.ApplicationModel.Activation; 

    app.onactivated = function (args) { 
     if (args.detail.kind === activation.ActivationKind.launch) { 
      if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 
       var notifications = Windows.UI.Notifications; 
       var recurrence = notifications.PeriodicUpdateRecurrence.halfHour; 


       var urls = [ 
        new Windows.Foundation.Uri("http://localhost/tile1.xml"), 
        new Windows.Foundation.Uri("http://localhost/tile2.xml"), 
        new Windows.Foundation.Uri("http://localhost/tile3.xml"), 
        new Windows.Foundation.Uri("http://localhost/tile4.xml") 
       ]; 


       notifications.TileUpdateManager.createTileUpdaterForApplication().enableNotificationQueue(true); 
       notifications.TileUpdateManager.createTileUpdaterForApplication().startPeriodicUpdateBatch(urls, recurrence); 

      } else { 
       // TODO: This application has been reactivated from suspension. 
       // Restore application state here. 
      } 
      args.setPromise(WinJS.UI.processAll()); 
     } 
    }; 

    app.oncheckpoint = function (args) { 
     // TODO: This application is about to be suspended. Save any state 
     // that needs to persist across suspensions here. You might use the 
     // WinJS.Application.sessionState object, which is automatically 
     // saved and restored across suspension. If you need to complete an 
     // asynchronous operation before your application is suspended, call 
     // args.setPromise(). 
    }; 


    app.start(); 
})(); 

我只是無法弄清楚什麼是錯的與代碼。請幫忙。

回答

0

那麼,你不能。環回是不允許的,所以如果你使用本地主機服務,你的應用不會通過認證。

你可以提供應用程序本身的圖像嗎?或者,設置一個外部服務來託管您的圖像和瓷磚。你真的只需要像Windows Azure blob存儲這樣的東西,甚至不需要託管一個Web服務。

最後,你要確保你總是包括一個方形瓷磚圖像。用戶始終擁有控制權,因此他們可能會選擇不將您的應用顯示爲寬廣的圖塊。