2015-06-11 33 views
0

我遇到了bandClient.TileManager.SetPagesAsync問題,它返回true,我認爲這意味着一切都成功了,但是當我點擊我的樂隊時,沒有任何內容顯示。我遺漏了下面的圖塊創建代碼,因爲我相信這樣可以正常工作,因爲我能夠成功發送消息。有任何想法嗎?在自定義頁面內容中沒有出現問題

private void CreateLeaderboardPageLayout(BandTile tile) 
    { 
     // create a scrollable vertical panel that will hold 3 text messages 
     ScrollFlowPanel panel = new ScrollFlowPanel 
     { 
      Rect = new PageRect(0, 0, 245, 102), 
      Orientation = FlowPanelOrientation.Vertical 
     }; 

     // add the text block to contain the first message 
     panel.Elements.Add(new TextBlock 
     { 
      ElementId = (short) TileMessagesLayoutElementId.Message1, 
      Rect = new PageRect(0, 0, 245, 102), 
      // left, top, right, bottom margins 
      Margins = new Margins(15, 0, 15, 0), 
      Color = new BandColor(0xFF, 0xFF, 0xFF) 
     }); 

     // add the text block to contain the second message 
     panel.Elements.Add(new TextBlock 
     { 
      ElementId = (short)TileMessagesLayoutElementId.Message2, 
      Rect = new PageRect(0, 0, 245, 102), 
      // left, top, right, bottom margins 
      Margins = new Margins (15, 0, 15, 0), 
      Color = new BandColor(0xFF, 0xFF, 0xFF) 
     }); 

     // add the text block to contain the third message 
     panel.Elements.Add(new TextBlock 
     { 
      ElementId = (short)TileMessagesLayoutElementId.Message3, 
      Rect = new PageRect(0, 0, 245, 102), 
      // left, top, right, bottom margins 
      Margins = new Margins(15, 0, 15, 0), 
      Color = new BandColor(0xFF, 0xFF, 0xFF) 
     }); 

     // create the page layout 
     var layout = new PageLayout(panel); 


     tile.PageLayouts.Add(layout); 
    } 

    public async Task UpdateLeaderBoard(IBandClient bandClient) 
    { 
     // create the object containing the page content to be set 
     var pageContent = new PageData(MSC_LEADERBOARD_GUID, 0, 
      new TextBlockData((Int16) TileMessagesLayoutElementId.Message1, 
       "This is the text of the first message"), 
      new TextBlockData((Int16) TileMessagesLayoutElementId.Message2, 
       "This is the text of the second message") 
      , 
      new TextBlockData((Int16) TileMessagesLayoutElementId.Message3, 
       "This is the text of the third message") 
      ); 
     var added = await bandClient.TileManager.SetPagesAsync(MSC_TILE_GUID, pageContent); 
    } 

回答

0

每個頁面最多有一個TextBlock/WrappedTextBlock的限制,其中包含超過20個字符的字符串。嘗試減少頁面數據TextBlock字符串中的字符數,看看是否有幫助。

+0

我也遇到過這個問題。當有超過20個字符時,文本塊將不會顯示。我遇到的問題是,當我點擊平鋪時,它說沒有什麼可報告的,稍後再回來查看。這是一個不同於20個字符限制的問題 – Tyler

+0

當圖塊顯示「稍後檢查」消息時,這意味着該圖塊沒有要顯示的數據頁面。如果應用程序試圖向磁貼添加一頁數據,但會顯示「稍後再檢查」消息,則表示該樂隊認爲該頁面數據無效並拒絕該數據。在頁面數據中有2個或更多的> 20個字符的文本字符串只是一個將被Band拒絕的頁面數據的例子。 –

+0

那麼樂隊會拒絕沒有錯誤的頁面?這似乎是因爲我將我的文本塊限制爲該頁面顯示的20個字符。由於排行榜中字符串的長度不同,我認爲它之前非常隨意 – Tyler

0

如果MSC_LEADERBOARD_GUID是常量,那可能是問題所在。每個PageData都需要一個唯一的Guid。如果你的磁貼上只有一個頁面,這應該不是問題,但改變它可能是值得一試的。

+0

我只有一個頁面,文檔說如果您重複使用相同的guid,它將更新該頁面而不是創建一個新頁面。 – Tyler

相關問題