Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO.IsolatedStorage;
- using System.Diagnostics;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Navigation;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
- using Microsoft.Phone.Media;
- using Windows.Phone.Media.Capture;
- using flashlight.Resources;
- using flashlightSettings;
- namespace flashlight
- {
- public partial class MainPage : PhoneApplicationPage
- {
- // Constructor
- public MainPage()
- {
- InitializeComponent();
- }
- /*private bool NightMode;
- private void setNight()
- {
- }*/
- async void Button1_Click(object sender, EventArgs e)
- {
- CameraSensorLocation camLocation = CameraSensorLocation.Back;
- IReadOnlyList<object> CameraModes;
- CameraModes = AudioVideoCaptureDevice.GetSupportedPropertyValues(camLocation, KnownCameraAudioVideoProperties.VideoTorchMode);
- if (CameraModes.ToList().Contains((UInt32)VideoTorchMode.On))
- {
- AudioVideoCaptureDevice flashLight;
- flashLight = await AudioVideoCaptureDevice.OpenAsync(camLocation, AudioVideoCaptureDevice.GetAvailableCaptureResolutions(camLocation).First());
- flashLight.SetProperty(KnownCameraAudioVideoProperties.VideoTorchMode, VideoTorchMode.On);
- }
- }
- private void Button2_Click(object sender, EventArgs e)
- {
- NavigationService.Navigate(new Uri("/Settings.xaml", UriKind.Relative));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement