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);
    }
4

2 回答 2

0

如果 MSC_LEADERBOARD_GUID 是一个常数,那可能就是问题所在。每个 PageData 都需要一个唯一的 Guid。如果您的磁贴上只有一页,那应该不是问题,但更改它可能值得一试。

于 2015-06-24T01:38:57.747 回答
0

每页最多有一个 TextBlock / WrappedTextBlock 的字符串超过 20 个字符。尝试减少页面数据 TextBlock 字符串中的字符数,看看是否有帮助。

于 2015-06-24T02:02:48.560 回答