Click here to Skip to main content
13,792,728 members

.NET Framework

 
AnswerRe: Problem validating data input to a DataTable Pin
Eddy Vluggen9-Nov-17 0:45
professionalEddy Vluggen9-Nov-17 0:45 
GeneralRe: Problem validating data input to a DataTable Pin
Ernesto R.D.9-Nov-17 1:57
memberErnesto R.D.9-Nov-17 1:57 
GeneralRe: Problem validating data input to a DataTable Pin
Eddy Vluggen9-Nov-17 3:49
professionalEddy Vluggen9-Nov-17 3:49 
QuestionCircle Progress in Visual Studio 2008 Pin
Member 135090597-Nov-17 17:25
memberMember 135090597-Nov-17 17:25 
AnswerRe: Circle Progress in Visual Studio 2008 Pin
Pete O'Hanlon7-Nov-17 22:47
protectorPete O'Hanlon7-Nov-17 22:47 
AnswerRe: Circle Progress in Visual Studio 2008 Pin
Gerry Schmitz8-Nov-17 5:01
memberGerry Schmitz8-Nov-17 5:01 
GeneralRe: Circle Progress in Visual Studio 2008 Pin
Member 135090598-Nov-17 14:48
memberMember 135090598-Nov-17 14:48 
QuestionCast issue with CaptureFileAsync() Pin
MA-Navinn26-Oct-17 3:54
memberMA-Navinn26-Oct-17 3:54 
Hi everybody,
I'm trying to figure out how to call windows camera UI from a windows form.
I did this and it does compile:
Public Function ShootPicture() As StorageFile
    Dim captureUI As New CameraCaptureUI
    captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg
    captureUI.PhotoSettings.AllowCropping = False
    Dim GetPhotoTask As Task(Of StorageFile) = captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo)
    GetPhotoTask.Wait() ' Blocks current thread until CaptureFileAsync task completes'
    Dim result As StorageFile = GetPhotoTask.Result
    Return result
End Function


But there is a 'System.InvalidCastException' execution error on .capturefileAsync() : type 'System._ComObject' cannot be casted as 'System.threading.tasks.task'

The idea of wait instead of await was to make the function Synchronous because I would rather to call it from a Protected Overrides Function. However I tried with the classic Async declaration and I don't have a better result (does not compile).

Dim GetPhotoTask As Task(Of StorageFile) = captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo)
      Dim Photo As StorageFile = Await GetPhotoTask

Would anyone have any idea on how to fix this? Thanks

If it can help here is the c# code translation:

public StorageFile ShootPicture()
{
    CameraCaptureUI captureUI = new CameraCaptureUI();
    captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
    captureUI.PhotoSettings.AllowCropping = false;
    Task<StorageFile> GetPhotoTask = captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
    GetPhotoTask.Wait();
    // Blocks current thread until CaptureFileAsync task completes
    StorageFile result = GetPhotoTask.Result;
    return result;
}

AnswerRe: Cast issue with CaptureFileAsync() Pin
Richard MacCutchan26-Oct-17 4:30
protectorRichard MacCutchan26-Oct-17 4:30 
AnswerRe: Cast issue with CaptureFileAsync() Pin
Richard Deeming26-Oct-17 4:53
mvpRichard Deeming26-Oct-17 4:53 
GeneralRe: Cast issue with CaptureFileAsync() Pin
MA-Navinn27-Oct-17 7:00
memberMA-Navinn27-Oct-17 7:00 
GeneralRe: Cast issue with CaptureFileAsync() Pin
MA-Navinn7-Nov-17 23:59
memberMA-Navinn7-Nov-17 23:59 
QuestionProcess data as you type Pin
Dirk Bahle13-Oct-17 9:21
mvpDirk Bahle13-Oct-17 9:21 
AnswerRe: Process data as you type Pin
Eddy Vluggen13-Oct-17 23:39
professionalEddy Vluggen13-Oct-17 23:39 
GeneralRe: Process data as you type Pin
Dirk Bahle14-Oct-17 2:34
mvpDirk Bahle14-Oct-17 2:34 
GeneralRe: Process data as you type Pin
Eddy Vluggen14-Oct-17 3:40
professionalEddy Vluggen14-Oct-17 3:40 
GeneralRe: Process data as you type Pin
Dirk Bahle14-Oct-17 8:27
mvpDirk Bahle14-Oct-17 8:27 
GeneralRe: Process data as you type Pin
Eddy Vluggen17-Oct-17 3:06
professionalEddy Vluggen17-Oct-17 3:06 
AnswerRe: Process data as you type Pin
Gerry Schmitz14-Oct-17 9:35
memberGerry Schmitz14-Oct-17 9:35 
GeneralRe: Process data as you type Pin
Dirk Bahle16-Oct-17 4:15
mvpDirk Bahle16-Oct-17 4:15 
AnswerRe: Process data as you type Pin
Pete O'Hanlon14-Oct-17 12:47
protectorPete O'Hanlon14-Oct-17 12:47 
GeneralRe: Process data as you type Pin
Dirk Bahle16-Oct-17 4:19
mvpDirk Bahle16-Oct-17 4:19 
QuestionAn unhandled exception of type 'System.AccessViolationException' occurred in System.Data.dll Pin
indian1434-Oct-17 16:30
memberindian1434-Oct-17 16:30 
AnswerRe: An unhandled exception of type 'System.AccessViolationException' occurred in System.Data.dll Pin
Richard MacCutchan4-Oct-17 23:22
protectorRichard MacCutchan4-Oct-17 23:22 
GeneralRe: An unhandled exception of type 'System.AccessViolationException' occurred in System.Data.dll Pin
indian1435-Oct-17 4:08
memberindian1435-Oct-17 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.181207.3 | Last Updated 8 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid