/// <summary> /// アンロード時の処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void _Unloaded(object sender, RoutedEventArgs e) { // カメラの表示を停止 var stopPreview = _cameraHelper?.StopPreview(); if (stopPreview != null) { await stopPreview; } }
/// <summary> /// アンロード時の処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void _Unloaded(object sender, RoutedEventArgs e) { // カメラの表示を停止 var stopPreview = _cameraHelper?.StopPreview(); if (stopPreview != null) { await stopPreview; } // 認証用に撮影した写真ファイルを削除 var folder = ApplicationData.Current.TemporaryFolder; var files = await folder.GetFilesAsync(); files.ToList().ForEach(async file => { if (file.FileType.ToUpper() == ".JPG") { await file.DeleteAsync(StorageDeleteOption.PermanentDelete); } }); }