private void LoadResolutions(CameraPosition cameraPosition) { IReadOnlyList <Windows.Foundation.Size> availableResolutions; AvailableResolutions.Clear(); if (cameraPosition == CameraPosition.Back) { availableResolutions = PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back); } else { availableResolutions = PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Front); } if (availableResolutions != null) { foreach (var resolution in availableResolutions) { AvailableResolutions.Add(new Resolution(resolution)); } } if (AvailableResolutions != null) { if (AvailableResolutions.Count > 0) { SelectedResolution = AvailableResolutions[AvailableResolutions.Count() - 1]; } } OpenCameraDevice(cameraPosition); }
private void LoadSettings() { try { IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; if (appSettings.Count() > 3) { //Flash if (appSettings.Contains("flashon")) { bool flashOn = (bool)appSettings["flashon"]; if (flashOn) { FlashOn = true; FlashOff = false; } else { FlashOff = true; FlashOn = false; } } //camera location if (appSettings.Contains("frontcameraselected")) { bool frontCamSelected = (bool)appSettings["frontcameraselected"]; if (frontCamSelected) { FrontCamera = true; BackCamera = false; } else { BackCamera = true; FrontCamera = false; } } if (appSettings.Contains("selectedresolution")) { //picture resolution string selectedResolution = (string)appSettings["selectedresolution"]; foreach (Resolution row in AvailableResolutions) { if (row.Display == selectedResolution) { SelectedResolution = row; } } //set resolution to default if there is no resolution if (SelectedResolution == null) { SelectedResolution = AvailableResolutions[AvailableResolutions.Count() - 1]; } } if (appSettings.Contains("mainscreenimage")) { //main image string mainImage = (string)appSettings["mainscreenimage"]; if (mainImage != null) { foreach (var row in ScreenShots) { if (row.Name == mainImage) { SelectedScreenShot = row; } } } } if (appSettings.Contains("soundon")) { //sound on or off bool sound = (bool)appSettings["soundon"]; if (sound) { SoundOn = true; SoundOff = false; } else { SoundOff = true; SoundOn = false; } } if (appSettings.Contains("picturecountvisibilityon")) { //sound on or off bool picCntVis = (bool)appSettings["picturecountvisibilityon"]; if (picCntVis) { PictureCountVisibilityOn = true; PictureCountVisibilityOff = false; } else { PictureCountVisibilityOff = true; PictureCountVisibilityOn = false; } } if (appSettings.Contains("focuson")) { //focus bool focusOn = (bool)appSettings["focuson"]; if (focusOn) { FocusOn = true; FocusOff = false; } else { FocusOff = true; FocusOn = false; } } } else { FlashOn = false; SoundOn = false; FlashOff = true; SoundOff = true; FocusOff = false; FocusOn = true; FrontCamera = false; BackCamera = true; PictureCountVisibilityOn = true; PictureCountVisibilityOff = false; } } catch (Exception ex) { } }