c# - 将内部枚举 'TileLayoutIndex' 转换为 int

标签 c# microsoft-band

我收到有关转换为 int 的错误消息。

代码如下:

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,        
    TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page
    new WrappedTextBlockData(
        (Int16)TileMessagesLayoutElementId.Message1,
        "This is the text of the first message"),
    new WrappedTextBlockData(
        (Int16)TileMessagesLayoutElementId.Message2,
        "This is the text of the second message"));

这是内部枚举代码:

internal enum TileLayoutIndex
{
    MessagesLayout = 0,
};

为什么会出现错误?

更新:

Guid messagesPageGuid = Guid.NewGuid();

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,

这个 Guid 东西可能是问题所在

最佳答案

你没有使用整数,所以你需要转换它:

// create the object containing the page content to be set
PageData pageContent = new PageData(
    messagesPageGuid,        
    (int)TileLayoutIndex.MessagesLayout, // Specify which layout to use for this page

关于c# - 将内部枚举 'TileLayoutIndex' 转换为 int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30291834/

相关文章:

c# - 序列化对象消失(BinaryFormatter)

c# - 如何检测 Microsoft Band 版本

c# - 是否可以在 WCF 操作中使用接口(interface)类型作为参数类型?

c# - 何时清除 Documents and Settings\USER\Local Settings\Temp 文件夹?

ios - 尝试呈现其 View 不在窗口层次结构中的 UIViewController

Microsoft Band 2 上的 UWP

ios - 在 iOS 中从 Microsoft Health Cloud API 获取用户健康数据

windows-phone-8.1 - Microsoft Band SDK 部署错误 : To ARM in Release: Raw error code: 2148733978

c# - Moon APNS 的未知错误 P12 文件

c# - Azure SQLite 插入