WinRT C#拍照没有对话框

时间:2013-03-07 09:25:41

标签: c# windows-runtime windows-store-apps

如果我想在WinRT中拍照,我需要调用此代码:

        var ui = new CameraCaptureUI();
        ui.PhotoSettings.CroppedAspectRatio = new Size(4, 3);

        var file = await ui.CaptureFileAsync(CameraCaptureUIMode.Photo);

        if (file != null)
        {
            IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            var bitmap = new BitmapImage();
            bitmap.SetSource(fileStream);
            Photo.Source = bitmap;
        }

但是,我想自动拍照,例如。每1分钟一次。因此,每分钟都不可能通过对话拍照。我可以拍摄照片吗?

1 个答案:

答案 0 :(得分:0)