I'm making a C#/XAML Windows 8 app using Bing Maps. I'm copying a bunch of Windows Phone 7 code over, and I'm having a problem simply plotting geocoords. Here's the WP7 code:
GeoCoordinate mapCenter = new GeoCoordinate(37.784, -122.408);
map1.Center = mapCenter;
However, when I try to instantiate mapCenter in Win 8, (and I do use lowercase Geocoordinate instead of GeoCoordinate) I get an error saying that "Windows.Devices.Geolocation.Geocoordinate does not contain a constructor that takes 2 arguments".
I'm sorta stumped, as I planned on using Geocoordinates quite a bit, and I'm not really sure how to figure out what exactly the Geocoordinate constructor takes.
thanks,
Amanda
Edited to fix code indentation
The Windows.Devices.Geolocation.Geocoordinate class cannot be directly instantiated. Also, keep in mind, that the namespace you are using is used specifically for retrieving location data from the device.
First, you'll need to get an instance of Geoposition via Geolocator.GetGeopositionAsync.
You can then get the Geocoordinate instance from Geoposition.Coordinate.
If you're looking to simply center the map on a given latitude and longitude (and you're using the Bing Maps for Windows Store Apps SDK), it looks like you should be using the Location class instead (as Map.Center is of type Location).
Your code and you error output are saying two different things. I had the same problem make sure you are using the capital C in GeoCoordianate in you code. teh lower case C in geocoordinate is for getting the phones location.
The Center property of the Map control requires a value of type GeoCoordinate from the System.Device.Location namespace. If you are using location services from the Windows.Devices.Geolocation namespace, you have to convert a Windows.Devices.Geolocation.Geocoordinate value to a System.Device.Location.GeoCoordinate value for use with the Map control.
You can get an extension method to do this conversion, along with other useful extensions to the Maps API, by downloading the Windows Phone Toolkit. If you want to write your own code, here is an example of a method that you can use to convert a Geocoordinate to a >GeoCoordinate:
from http://msdn.microsoft.com/en-US/library/windowsphone/develop/jj207045(v=vs.105).aspx#BKMK_converting
Related
How do you call this method on Nvidia GPU:
NVAPI_INTERFACE NvAPI_GPU_SetEDID (
NvPhysicalGpuHandle hPhysicalGpu,
NvU32 displayOutputId,
NV_EDID * pEDID
)
Src: http://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/group__gpu.html#ga6a41b31dd9743120213435d985f8fbcf
I need to execute the above command to remove all EDID set on all DisplayOutputs on our new Quadro Graphics Cards. Based on the API documentation, I tried searching for NvPhysicalGpuHandle and came across this project/library:
https://github.com/openhardwaremonitor/openhardwaremonitor/blob/master/Hardware/Nvidia/NVAPI.cs
This does not have the method I need NvAPI_GPU_SetEDID
I am not hardware programmer, I just need to be able to call this one command. any ideas? Can this be achieved using nvapi.dll/nvapi64.dll via pinvoke or something?
I personally didn't test this, but you can try the library and see if it can set EDID information without any problem, if it fails, please open an issue.
https://github.com/falahati/NvAPIWrapper
Here is how you should do it,
First, you need to find the right DisplayDevice or GPUOutput that you want to write EDID information to. There are multiple ways to do so.
Get a list of all PhysicalGPUs in the system using the NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs() static method, then select the PhysicalGPU you desire based on your logic. After finding the right PhysicalGPU, use the NvAPIWrapper.GPU.PhysicalGPU.GetDisplayDevices() method to get a list of all connected DisplayDevices to that GPU and store the right one in a variable.
Instead of searching for connected DisplayDevices, you can also go for the GPUOutputs. Just like before, you first need to find the right PhysicalGPU and then you can get a list of all GPUOutputs using the NvAPIWrapper.GPU.PhysicalGPU.ActiveOutputs property and store the right GPUOutput in a variable.
Another way to find the right DisplayDevice is to go for a list of all Displays. To do so, you need to use the NvAPIWrapper.Display.Display.GetDisplays() static method. This returns an array of Displays. Then using the NvAPIWrapper.Display.Display.DisplayDevice property, you can get the corresponding DisplayDevice of a Display.
After finding the right DisplayDevice or GPUOutput, you should use the NvAPIWrapper.GPU.PhysicalGPU.WriteEDIDData() method. This method allows you to write EDID data stored in a byte array to the DisplayDevice or the GPUOutput you selected before.
Note: Make sure to capture NVIDIAApiException and check for the NVIDIAApiException.Status property in case something went wrong.
I am writing app (Windows Phone 8.1 Store App) that allows user to connect to IP Camera. I am using FFmpeg Interop library for ffmpeg which allows me to play eg. rtsp streams in media element. I need now a way to somehow extract a single frame from stream or from media element.
I have tested other application wchih allows connecting to IP cameras - IP Centcom, and they have working snapshots only for mjpeg streams as far as I now (they were not working for rtsp). Becouse of that I belive that it is impossible or at very least very hard to export frame from media element.
I have different question - if anyone has ever used FFmpeg Interop and would like to help/explain me how could I modify/extend FFmpegInteropMSS to add method called 'GetThumbnailForStream' that would work similary to 'GetMediaStreamSource' but would return single frame (bitmap or jpg) instead of MediaStreamSource?
Every help would be appreciated
EDIT:
I have found something;
in MediaSampleProvider in method WriteAVPacketToStream (line ~123) there is line
auto aBuffer = ref new Platform::Array<uint8_t>(avPacket->data, avPacket->size);
and I belive that this is the place that stores single frame data that is needed to convert into bitmap - now since I do not know c++ too much I have a question : how can I convert it into a form that I could return via public method ?
When returning:
Platform::Array<uint8_t>^
I get
'FFmpegInterop::MediaSampleProvider' : a non-value type cannot have any public data members
EDIT2:
Ok I am doing approprate projection to byte according to this microsoft information, now I need to check if this is correct data.
So, long story short: I'm writing a POS program, and I have a receipt printer connected and the Windows Forms printing API works great with it, much easier than I expected.
However, searching through the API, it seems that the easiest (or perhaps only) way to programmatically print something is to use the Graphics object inside the PrintPageEventArgs object in the printer's event handling method.
Every overloaded parameter list for the Graphics.DrawXXX() method requires some kind of coordinate pair to use as a reference point for where to start drawing the object passed to it.
So my question is, let's say I want to print some string value, and then an Image. Doing it the other way around (first the Image, then the string) would be easy because the reference point to start drawing the string would be (0, Image.Size.Height). However, since a string does not have a "size" associated with it, what is the best way to go about telling the printer where to start drawing an image after a string has been printed?
Let me know if this is confusing or needs additional clarification.
I have a database and every person has a location.
In this point, l need some sugesstions to show all the person's location in a single map.
To give an example,
X man = at y, X1 man = at z,X2 man = at q
y,z,q will be shown in a singe map?
start by reading this article:
Show Your Data on Google Map using C# and JavaScript
if you have more specific questions ask more details
i think it will helps you
The Google Maps API is accessed via JavaScript (any server controls are just abstracting this away from you). In the case you described, you would need to dynamically output the required JavaScript to tell the maps API what to display.
See http://dotnet.sys-con.com/node/171162
I'm porting an iPhone game to Windows Phone 7, and I'm wondering how I would go about getting the phone's name? Like, on the iPhone it would be the name you had set it to in iTunes, and that's also readable in the API with (obj-c..) [[UIDevice currentDevice] name]..
Anyone know the equivalent WP7 .NET methods/properties? I can't find them on MSDN.
You can get the manufacturer specified name of the device via:
Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceName").ToString();
Note that "There is no standard format for this string. This value may be empty."
More at: http://msdn.microsoft.com/en-us/library/ff941122(VS.92).aspx
My guess is you are going to be working in the Microsoft.Phone.Info namespace, but they have not released members of the DeviceExtendedProperties or UserExtendedProperties classes yet.
MSDN Namespace Info
If you are using XNA, use the static SignedInGamers property of the Gamer class.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gamerservices.gamer.signedingamers.aspx
Edit: I thought you meant owner's name, like their gamertag or name, instead of what they named the device.
Use DeviceStatus.DeviceName of Microsoft.Phone.Info directive
Refer: http://dotnetspeaks.com/DisplayArticle.aspx?ID=151