Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User
async ;

Async Task in Sync Methode

01.11.2019 (👁123)


Wie führt man in C# eine asynchrone Methode innerhalb einer synchronen Methode aus ?

Problem: hier Async Aufruf in Sync -Event

Async await

            ApplicationData.Current.LocalSettings.Values["Set_CameraNr"]=CameraNr.SelectedIndex ;

            mainpage._mediaCapture = null;

            mainpage.InitializeCameraAsync();    

Lösung:
Task task

Man erstellt einen Task welcher die Methode aufruft

            Task task = mainpage.InitializeCameraAsync();

            var result = task.Wait(-1); //wait 1 sek