标签: windows-10-universal

有没有办法在 Windows 10 (UWP) 项目中进行非 UI 单元测试?

通用 Windows 平台应用程序有单元测试项目,但它运行测试速度非常慢。我认为这是因为 Xaml UI 测试。有人知道在单元测试中禁用 UI 测试的方法吗?

c# unit-testing windows-10-universal

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

在 Windows 10 中配置图像控制

注意:通用 Windows 平台(又名 Windows 10 应用程序,而不是 WPF)

我有大约 80 个图像文件需要显示在页面内的列表视图上。当用户返回上一页时,我需要处理图像控件,以便删除这些图像。

问题是直接绑定到image uri锁定了图片文件,返回时并没有释放

我正在使用 MVVMLight

一些代码:

public class FileNameToFullUriConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        string ori = value.ToString();
        string file = ori.Split('/').Last();
        string img = file.Split('.')[0] + ".png";
        img = "ms-appdata:///local/" + StaticClass.ImageFolder + "/" + img;

        return img;

    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

和 XAML

<DataTemplate>
    <Grid>
        <Image x:Name="Image2"
               Grid.Column="1" …
Run Code Online (Sandbox Code Playgroud)

c# image mvvm-light windows-10 windows-10-universal

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

错误:DEP0500

我尝试编译多个 Windows10 UWP 程序,但不断收到此错误:

Error : DEP0500 : The folder "C:\Users\Ikponmwosa\Documents\Visual Studio 2015\Projects\App19\App19\bin\x86\Debug\AppX" could not be deleted.
 Access to the path 'App19.exe' is denied.      
Run Code Online (Sandbox Code Playgroud)

当我重新启动 VS2015 并第一次运行该程序时,它编译并显示空白屏幕。随后的编译会导致上面显示的错误 DEP0500。

compiler-errors windows-10-universal

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

Windows 10 UAP 中的交互行为

我正在尝试使用 XAML 中的 Interaction.Behaviors 将事件绑定到我的控制器,如下所示,

<GridView x:Name="mygrid" >
    <interact:Interaction.Behaviors>
        <interactcore:EventTriggerBehavior EventName="SelectionChanged">
            <interactcore:InvokeCommandAction
                Command="{Binding Controller.Test}"
                CommandParameter="{Binding ElementName=mygrid, Path=SelectedItem}"/>
        </interactcore:EventTriggerBehavior>
    </interact:Interaction.Behaviors>
</GridView>
Run Code Online (Sandbox Code Playgroud)

这工作完美,除了... Visual Studio 2015 显示以下错误,

Severity    Code    Description Project File    Line    Suppression State
Error       The name "EventTriggerBehavior" does not exist in the namespace "using:Microsoft.Xaml.Interactions.Core".   MVC C:\Prototype\MVC\MVC\MainPage.xaml  19  
Error       The name "InvokeCommandAction" does not exist in the namespace "using:Microsoft.Xaml.Interactions.Core".    MVC C:\Prototype\MVC\MVC\MainPage.xaml  20  
Error       The name "Interaction" does not exist in the namespace "using:Microsoft.Xaml.Interactivity".    MVC C:\Prototype\MVC\MVC\MainPage.xaml  18  
Run Code Online (Sandbox Code Playgroud)

这导致设计器崩溃,因此即使代码有效,设计器也没有。有任何想法吗?

我的包括...

xmlns:interact="using:Microsoft.Xaml.Interactivity"
xmlns:interactcore="using:Microsoft.Xaml.Interactions.Core"
Run Code Online (Sandbox Code Playgroud)

为了澄清起见,我通过“添加引用...”对话框包含了行为 …

c# xaml windows-10-universal

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

无法从 Microsoft 符号服务器下载“ntdll.dll”的符号

我正在尝试将我的 Windows Phone 8 应用程序移植到 Windows 10。我能够构建我的应用程序。当我尝试在移动模拟器上的Release x86 中部署我的应用程序时,它失败并提供以下信息:

无法从 Microsoft 符号服务器下载 ntdll.dll 的符号。异常字符串和调用堆栈可能无法正常工作。确保您有网络连接,然后重试

即使我试图在发布模式下运行我的应用程序,我也不知道为什么 VS-2015 很费力地下载这些调试符号。
经过在互联网上的一些搜索,我已经完成了这些,但我仍然看到这个问题:

有没有人遇到过这个问题?

windows debug-symbols win-universal-app visual-studio-2015 windows-10-universal

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

UWP Httpclient postasync在后台任务中使用json字符串

我只想在我的UWP应用程序中将一些json从后台任务发布到api,然后取回响应来读取它.我的后台任务经常失败

Platform :: DisconnectedException ^在内存位置0x077FEE74.

我尝试了很多方法来使用互联网上的东西,但只是稍微调整失败.没有代码,我可以完美地执行后台任务.

这里的代码:

public async void Run(IBackgroundTaskInstance taskInstance)
        {
            _deferral = taskInstance.GetDeferral();

HttpClient aClient = new HttpClient();

            aClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            aClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/javascript"));



        Uri theUri = new Uri("https://m.xxxx.com/api/v4/session?expand=account,profile)");

StringContent theContent = new StringContent("{ \"keep_login\": true, \"id\": null, \"username\": \"zumbauser\", \"password\": \"zumbapw\" }", Encoding.UTF8, "application/json");


        HttpResponseMessage aResponse = await aClient.PostAsync(theUri, theContent);

        if (aResponse.IsSuccessStatusCode)
        {
            Debug.WriteLine("This is outpuuuuuuuuuuuuuut: " + aResponse.ToString());
        }
        else
        {
            // show the response status code 
            String failureMsg = "HTTP Status: " + aResponse.StatusCode.ToString() + " …
Run Code Online (Sandbox Code Playgroud)

json httpclient background-task uwp windows-10-universal

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

将 UWP 应用上传到 Windows 应用商店时出错:无法合并 PRI 文件 \Resources_split.scale-100.pri

我正在将应用程序的最新版本上传到 Windows 商店,但我的应用程序抛出错误:

包接受验证错误:我们在解析包 MyApp.UWP_2.33.0.0_x86_x64_ARM_AppStore.appxbundle 时遇到致命错误:无法合并 PRI 文件 D:\data\Temp\69b5c2ab-3419-4197-839c-2ef13d218413\Resources_split.scale- 100.pri: 80070490。重试或上传新包。

我不明白从哪里开始修复这个错误。

还有其他人看到过这个错误或者有任何倾向它可能是什么吗?

在附件上运行时也会引发类似的错误,Windows App Certification Kit如下所示:

在此输入图像描述

到目前为止我已经尝试过:

  • 运行 WsReset
  • 运行 sfc /scannow
  • 增加应用程序版本号

以上均无效

难道是这个msbuild错误:https://developercommunity.visualstudio.com/content/problem/107928/get-merge-failure-for-shared-merged-pri-file-0x800.html

windows-store uwp windows-10-universal

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

如何正确从 SoftwareBitmap (UWP) 中释放 BitmapBuffer?

我很难在 UWP 上的 C++/CX 代码中正确释放BitmapBuffer锁定的方法。SoftwareBitmap.LockBuffer()

基本代码如下所示(这是来自 Microsoft 的 OpenCV 桥示例,可在此处获取)。

bool OpenCVHelper::GetPointerToPixelData(SoftwareBitmap^ bitmap, unsigned char** pPixelData, unsigned int* capacity)
{
   BitmapBuffer^ bmpBuffer = bitmap->LockBuffer(BitmapBufferAccessMode::ReadWrite);
   IMemoryBufferReference^ reference = bmpBuffer->CreateReference();

   ComPtr<IMemoryBufferByteAccess> pBufferByteAccess;
   if ((reinterpret_cast<IInspectable*>(reference)->QueryInterface(IID_PPV_ARGS(&pBufferByteAccess))) != S_OK)
   {
    return false;
   }

   if (pBufferByteAccess->GetBuffer(pPixelData, capacity) != S_OK)
   {
    return false;
   }
   return true;
}
Run Code Online (Sandbox Code Playgroud)

然后该缓冲区 ( pPixelData) 用于初始化cv:Mat对象(浅拷贝)。并且永远不会被释放。

连续调用LockBuffer()同一SoftwareBitmap对象会引发异常:

Platform::AccessDeniedException ^ 位于内存位置 0x00000002CEEFDCC0。HRESULT:0x80070005 访问被拒绝。WinRT 信息:已获取位图共享锁

如何正确释放这个缓冲区?特别是在 C++/CX 中?

我尝试保留引用,以便在不再需要时释放它。在 C++/CX 中,Dispose() 或 …

windows c++-cx windows-10-iot-core uwp windows-10-universal

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

当列表视图滚动到最后一项/无限滚动列表视图时,UWP列表视图加载更多数据

我的 UWP (Windows 10) 应用程序中有一个列表视图。理想情况下,应用程序启动时它将加载 100 个项目。

当列表滚动到底部(即列表视图中的最后一个项目)时,API 调用将进行并加载另外 100 个项目等。

这是我的代码:

<ListView x:Name="lstSuggestions" Height="200" Width="250" Foreground="#333eb4" HorizontalAlignment="Left" Margin="60,10" SelectionChanged="lstSuggestions_SelectionChanged"></ListView>
Run Code Online (Sandbox Code Playgroud)

以下调用绑定列表视图(应用程序启动时的前 100 个项目):

public async void GetData(string Id, string limit)
    { 
        string mainUrlForSuggestions = ApiUrl +  "&id=" + d;
        string finalSelCharas = "";

        using (var httpClient = new HttpClient())
        {
            var dataUri = await httpClient.GetStringAsync(mainUrlForSuggestions);
            JsonObject jsonObject = JsonObject.Parse(dataUri.ToString());
            JsonArray jsonArray = jsonObject["payload"].GetArray();
            foreach (JsonValue groupValue in jsonArray)
            {
                JsonObject groupObject = groupValue.GetObject();
                lstSuggestionsAdd.Add(new SuggestedWords { Name = groupObject.GetNamedString("sug_name"), ID …
Run Code Online (Sandbox Code Playgroud)

c# listview uwp windows-10-universal uwp-xaml

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

在 C#、Windows 10 中创建虚拟摄像头,以与 Zoom、Skype、浏览器配合使用

我想创建一个“虚拟相机”,可以与 Zoom 或 Skype、浏览器等第三方应用程序一起使用。同样,这些应用程序也可以与 Snap 等虚拟相机应用程序一起使用。

我想从笔记本电脑上的内置网络摄像头获取源,对其进行一些更改,例如亮度,然后能够在 Zoom、Skype、浏览器、我编辑的源中进行选择。

到目前为止,我已经编写了一些通用 Windows 平台应用程序,它获取网络摄像头源,对其应用我的处理,并将其显示在窗口中。为此,我使用了 Windows Media API。 https://learn.microsoft.com/en-us/uwp/api/windows.media.effects?view=winrt-19041

任何人都可以为我指明如何获取此修改后的提要并将其提供给 Zoom、Skype、浏览器的正确方向吗?我看过很多与 DirectShow 相关的内容,但没有任何内容是完全有意义的或者是在过去 6 或 7 年内编写的。2020 年使用 C# 实现这一目标的最佳方法是什么?

非常感谢

c# camera directshow windows-10-universal mediacapture

5
推荐指数
0
解决办法
5659
查看次数