❔ C Task this.Dispatcher.Invoke lock problem
I will get the data every time the page is loaded with the task, but the program hangs with invoke while the task is waiting
private void Page_Loaded(object sender, RoutedEventArgs e)
{
letspaly = Task.Run(() => loadItem());
letspaly.Wait();
Debug.WriteLine("End ?");
} public void loadItem()
{
using (var entitydb = new AyetContext())
{
this.Dispatcher.Invoke(() =>
{
listBorder.Visibility = Visibility.Visible;
stackBorder.Visibility = Visibility.Collapsed;
});
}
}