I have followed this tutorial. My first issue is that when I want to add the reference to Windows, I have a full list of references
As you can see, I added all to my project to make it works, and the other references of the tutorial. But my application won't compile :(
I have this error :
Not implemented (Exception HRESULT : 0x80004001 (E_NOTIMPL))
And this one
Cannot resolve dependency to Windows Runtime type 'Windows.Foundation.Metadata.PlatformAttribute'. When using the ReflectionOnly APIs, dependent Windows Runtime assemblies must be resolved on demand through the ReflectionOnlyNamespaceResolve event.'
I have seen this post but it seems that the issue the author encounter is not the same as mine, because he had it to runtime (exception thrown), whereas I have to compile-time.
Is anyone have an idea how to proceed ?
For information : the main purpose of this is to have access to Windows.Devices.Sensor to have the screen orientation, cause we have an application that takes photo from WebCam in WPF, and when we use it on Surface tablet, the picture display on screen didn't follow the orientation of the tablet, which makes picture really hard to take.
Thanks all
This works fine for me - not sure why you're getting the runtime metadata (one winmd per top-level namespaces) rather than the design-time metadata (single winmd). This is what I did on my 8.1 machine:
<TargetPlatformVersion>8.1</TargetPlatformVersion>
directly below the existing <TargetFrameworkVersion>4.5</TargetFrameworkVersion>
elementThen I added the following code to MainWindow.InitializeComponent
:
var sos = Windows.Devices.Sensors.SimpleOrientationSensor.GetDefault();
Debug.WriteLine(sos == null ? "No sensor" : sos.GetCurrentOrientation().ToString());
It compiles and runs correctly, but there is no sensor on my desktop, so prints "No sensor".
If you can't get the references UI to show you the design-time metadata, browse to C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd
User contributions licensed under CC BY-SA 3.0