This my code block.
private async void BtnApplyall_Click(object sender, RoutedEventArgs e)
{
try
{
ucLoading.Visibility = Visibility.Visible;
await Task.Run(() => ApplyScenarios());
}
catch (Exception ex)
{
throw;
}
}
public Task ApplyScenarios()
{
try
{
Dispatcher.Invoke(() =>
{
ApplyAllScenarios(ucScenarioContainer.Children);
ucLoading.Visibility = Visibility.Hidden;
});
}
catch (Exception ex)
{
throw;
}
return Task.CompletedTask;
}
My problem is I clicked BtnApplyAll button and then my UI locked until process finished. And My progressbar not turn because of UI locked. I used Task and Dispacther but did not work. How can I handle this problem.