小编Jos*_*gal的帖子

如何解决"'IAsyncActionWithProgress <>'在Windows UAP应用程序中未引用的程序集中定义"

我正在Visual Studio Ultimate CTP 2015中开发一个Windows UAP应用程序(最新的一个在站点中可用).

我在使用await函数返回IAsyncActionWithProgress <>,IAsyncAction <>,IAsyncOperation <>和IAsyncOperationWithProgress <>时遇到问题.

我收到以下错误

错误CS0012类型'IAsyncActionWithProgress <>'在未引用的程序集中定义.您必须添加对程序集'Windows,Version = 255.255.255.255,Culture = neutral,PublicKeyToken = null,ContentType = WindowsRuntime'的引用.

我尝试添加对所提到的程序集的引用(Windows).即使这解决了上述错误,它在许多其他地方创建了另一个错误(似乎在两个程序集中都有一些类/ API的重复.获得的错误之一是:

错误CS0433'Page.'类型'Page'存在于'Windows.Foundation.UniversalApiContract,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null,ContentType = WindowsRuntime'和'Windows,Version = 255.255.255.255,Culture = neutral,PublicKeyToken = null,ContentType = WindowsRuntime'.

代码示例

Windows.Storage.FileProperties.BasicProperties fileSize = await file.GetBasicPropertiesAsync();
Run Code Online (Sandbox Code Playgroud)

这适用于Visual Studio 2013中的Windows Phone 8.1应用程序.为了在Visual Studio 2015中的UAP应用程序中获得相同的结果,我必须做出哪些更改.

windows async-await windows-10

6
推荐指数
1
解决办法
3433
查看次数

如何防止在Windows Phone 8.1中按下主页键时关闭ContentDialog ..?

private IAsyncOperation<ContentDialogResult> _Task = null;
private ContentDialog _message = null;            


        _message = new ContentDialog()
        {
            Content = "Hello",
            PrimaryButtonText = "EXIT",
            IsPrimaryButtonEnabled = true,
        };

        _message.PrimaryButtonClick += message_PrimaryButtonClick;
        _Task = _message.ShowAsync();
Run Code Online (Sandbox Code Playgroud)

在这里,我创建了一个内容对话框的任务,以便我可以从代码中显式关闭ContenDialog.

 How can I prevent dialog from closing when Home key is pressed and relaunched 
Run Code Online (Sandbox Code Playgroud)

messagedialog windows-phone-8.1

3
推荐指数
1
解决办法
2072
查看次数

相邻数组元素的地址之间的差异..?

我只是对以下代码得到的输出感到困惑:

int arr[] = {10,20,30};
cout<<&arr[1]<<"\t"<<&arr[0]<<"\t"<<&arr[1] - &arr[0];
Run Code Online (Sandbox Code Playgroud)

我得到的输出就像

0046F7A0    0046F79C    1
Run Code Online (Sandbox Code Playgroud)

我想知道为什么地址之间的差异为 1(我期望为 4)...?这与指针减法有关吗?

c++ arrays

2
推荐指数
1
解决办法
780
查看次数

如何从Windows Phone 8.1中的代码中解除MessageDialog

如何在Windows Phone 8.1中以编程方式关闭"消息"对话框.我使用showAsync()创建了对话框.如果这不可能,这是创建具有以下属性的自定义消息对话框的最佳方法:

1. It can show test and hold buttons for user interaction.
2. It can be dismissed programmatically
3. Should block the view as a Normal MessageDialog do
Run Code Online (Sandbox Code Playgroud)

windows messagedialog windows-phone-8.1

1
推荐指数
1
解决办法
1837
查看次数