Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# windows应用商店应用程序上的图片拍摄和处理速度较慢_C#_Image_Windows Store Apps - Fatal编程技术网

C# windows应用商店应用程序上的图片拍摄和处理速度较慢

C# windows应用商店应用程序上的图片拍摄和处理速度较慢,c#,image,windows-store-apps,C#,Image,Windows Store Apps,我正在开发一个用于Surface RT的windows应用商店应用程序。 这基本上是一个问卷,每个问卷需要3张图片。 这就是我预览和拍照的方式 async public void TakePictureFor(RackAuditQuestions q) { CameraCaptureUI cameraUI = new CameraCaptureUI(); cameraUI.PhotoSettings.AllowCropping = false;

我正在开发一个用于Surface RT的windows应用商店应用程序。 这基本上是一个问卷,每个问卷需要3张图片。 这就是我预览和拍照的方式

    async public void TakePictureFor(RackAuditQuestions q)
    {
        CameraCaptureUI cameraUI = new CameraCaptureUI();
        cameraUI.PhotoSettings.AllowCropping = false;
        cameraUI.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.MediumXga;
        Windows.Storage.StorageFile capturedMedia = await cameraUI.CaptureFileAsync(CameraCaptureUIMode.Photo);            
        if (capturedMedia != null)
        {                
            using (var streamCamera = await capturedMedia.OpenAsync(FileAccessMode.Read))
            {
                BitmapImage bitmapCamera = new BitmapImage();
                bitmapCamera.SetSource(streamCamera);
                // This display the image in a bound object to the XAML
                q.Image = bitmapCamera;                    
                int width = bitmapCamera.PixelWidth;
                int height = bitmapCamera.PixelHeight;
                q.pictureStream = await capturedMedia.OpenAsync(FileAccessMode.Read);
            }
        }
    }
经过大约7天的大量使用后,从我触摸屏幕的那一刻起,拍摄一张照片需要18秒以上的时间,直到控制权回到用户手中。我发了一封信

*我说的大量使用是指每天100张图片。重新安装应用程序会使一切正常,但不会重新启动surface或应用程序


我不明白,因为拍照过程基本上是委托给操作系统的。我不知道去哪里找。如果您使用CaptureFileAsync(像我一样),任何想法都会证明在这里的临时文件夹中存储了一份图片副本: C:\Users{username}\AppData\Local\Packages{your package guid}\TempState (在package.appxmanifest中设置包的名称)

您可以通过执行以下操作获得代码中的文件列表

StorageFolder temp = ApplicationData.Current.TemporaryFolder;
IReadOnlyList<StorageFile> fileList = await temp.GetFilesAsync();
StorageFolder temp=ApplicationData.Current.temporary文件夹;
IReadOnlyList fileList=await temp.getfileasync();
我只是在向服务器提交数据时将它们全部删除,但这取决于您。 Hoipe这对任何陷入这个问题的人都有帮助,因为它帮助了我