Search code examples
c#.netenumsenumeration

Using Enumeration in C#


I'm writing my first ever C# application, for Windows Phone Mango. It's designed to be an extremely simple flashlight app.

Previously, it wasn't possible to access the camera's flash on Windows Phone, but in this latest version, it is. Here's the documentation about it:

http://msdn.microsoft.com/en-us/library/microsoft.devices.flashmode(v=vs.92).aspx

Unfortunately, that makes absolutely no sense to me. I have the button set up and and the if-then statements working to switch the button icon and text on click. I just can't figure out how to actually turn the flash on and off. I'd appreciate a clear example so I can finish this up.

For those of you who don't want o leave the site...That link basically says this:

public enum FlashMode

Members: On, Off, Auto, RedEyeReduction


Solution

  • The FlashMode enumeration is just a set of values representing valid values for FlashMode. FlashMode, however, seems to define how the flash behaves when you take a picture. "On" seems to mean that the flash will always flash. It doesn't seem to mean that the light itself is "on" in the sense of producing light continuously.

    A bit of evidence in favor of this: the FlashMode documentation says that FlashMode.On means "The camera flash is enabled."