If you use CameraCaptureUI, the user will be prompted for permission automatically. But the DeviceInformation API does not indicate whether or not the user has granted permission.
Here is sample class that you can use to see whether a camera is available, with support for data binding
Posted by admin as Windows Phone
It is very easy to check if the user has enabled Location Services (GPS) in Windows Phone.
GeoCoordinateWatcher g = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
if (g.Permission == GeoPositionPermission.Denied)
// then we know it is off, else we assume it is on
// Show message box..
// Ensure the you properly dispose the watcher
One catch here is [...]
When you compile your windows phone app, it might build fine but throw an “unspecified error” when you try to deploy your app either onto your phone or to the emulator. The most probable reason that causes this is that there is style incompatibility in your xaml that the parser failed to resolve.
To fix the [...]
It is very easy to convert a string to stream and vice versa in .Net.
Converting String to Stream:
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
if you already know the encoding of your string, you can also use
byte tempByteArray = Encoding.ASCII.GetBytes(myString);
MemoryStream stream = new MemoryStream(tempByteArray);
Converting Stream to String:
StreamReader reader = new StreamReader(stream);
stream.Position = 0;
In a .Net 4.0 or later web application you may receive an error similar to
“The configuration section yoursection cannot be read because it is missing a section declaration”
when you try to get the web configuration information using Microsoft.Web.Administration.ServerManager API even when your web.config file looks alright and you do declare “yoursection” in the [...]
On windows Phone, you can easily use templates to change the default UI for most of the controls. In this post, I am giving an example of how to change the color of a scroll bar in a list box. The template I provided here is extensive and can use used to change many things [...]
Accelerometer; Simulating accelerometer data in the Windows Phone 7 Emulator
Animation; Ptorr Slides, Video and Code (Page Turn animation etc.)
Audio; Audio Recording in WP7
Comms; Accessing WCF Data Services from WP7 CTP
Comms; Calling Web Services with Silverlight 2 (general example)
DB; Siaqodb on [...]
The other day I was struggling to write a small LINQ query, and after searching for a while I found this awesome page on MSDN which has about 101 LINQ samples. The samples cover most of the basic LINQ stuff that one would need. Here is the location
101 LINQ Samples: @ http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx
One of the requirements in publishing media related apps for windows phone is that you have to prompt user a message asking his permission to continue if a media file is already being played in the background.
Here is the actual text from the app requirements
6.5.1 Initial Launch Functionality When the [...]