gists/async-from-ui.cs

16 lines
308 B
C#

// Basic function handling to having async tasks being run from an interface action in C# WPF.
private async void Clicked(object sender, RoutedEventArgs e)
{
await Function();
}
public async Task Function()
{
await Task.Run(async () =>
{
await someCommand();
});
UI_things();
}