相关疑难解决方法(0)

如何从常规(非存储)Win32 .NET应用程序中使用Windows.UI命名空间?

问题基本上与可能从常规.Net应用程序使用Toast Notifications有关吗?

如何从常规(非存储)Win32 .NET应用程序(控制台,WinForms,WPF)中使用Windows.UI命名空间?

.net c# microsoft-metro windows-8

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

将UWP库加载到.NET Framework应用程序中

有许多文章(codeproject,blog1,blog2,论坛)将WinRT库用于Windows 8中的.Net Framework控制台应用程序.

我在Windows 10中尝试使用UWP.但未能成功.我努力编译没有错误,但它发生BadImageFormatException在运行时.

这就是我做的.

  1. 使用.NET Framework 4.6.1目标创建控制台应用程序.
  2. 编辑要添加的.csproj文件 <TargetPlatformVersion>10.0</TargetPlatformVersion>
  3. 参考下面的三个库.
    • c:\ Program Files(x86)\ Windows Kits\10\UnionMetadata\Windows.winmd(显示Windows运行时1.4)
    • c:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1\System.Runtime.WindowsRuntime.dll(显示4.0.10.0)
    • c:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1\System.Runtime.InteropServices.WindowsRuntime.dll(显示4.0.0.0)

与Windows 8示例相反,System.Runtime.dll引用时会出错.

代码如下.请注意,该代码来自Microsoft论坛.

class Program
{
    static void Main(string[] args)
    {

        Geolocator locator = new Geolocator();
        var status = Geolocator.RequestAccessAsync();

        if (status != null)
        {
            Console.WriteLine("not null");
            Task.Run(async () =>
            {
                Geoposition pos = await locator.GetGeopositionAsync();
                Console.WriteLine(pos.Coordinate.Accuracy);
            });
        } …
Run Code Online (Sandbox Code Playgroud)

.net c# windows-runtime uwp

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

桌面 C# - 引用 Windows.Devices

我正在尝试用 C# 为 Windows 10 创建一个经典的桌面应用程序,它将能够与 BLE 设备通信。我按照说明(适用于 Windows 桌面 C# 应用程序的蓝牙 4.0(低功耗)API)并将标签添加到项目文件中

<TargetPlatformVersion>10.0.10156</TargetPlatformVersion>
Run Code Online (Sandbox Code Playgroud)

并重新加载项目。我只能访问 Windows 命名空间:引用对话框

我不知道我在其中一项测试中做了什么,但是一旦该列表填充了大量其他命名空间,我就可以检查 Windows.Devices 命名空间,这对我的项目至关重要。我现在可以通过最近选项添加 Windows.Devices,但不能添加任何其他命名空间...

你们知道我应该怎么做才能访问所有 Windows.xy 命名空间的列表吗?

c# windows reference bluetooth-lowenergy windows-10-desktop

5
推荐指数
2
解决办法
7007
查看次数

UWP之外的C#可以访问Windows ML学习模型吗?

我有一个希望从C#Windows服务(非UWP)中评估图像的ONNX模型。在构建UWP应用程序之外,我看不到从C#进入Windows ML框架的任何方法,对吗?

我发现这篇文章似乎表明从C ++可以实现。

至少有一个众所周知的COM包装器或其他东西吗?

c# windows-machine-learning

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