C#C
C#4y ago
frknztrk

❔ C Task this.Dispatcher.Invoke lock problem

 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;
                });

            }

}



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
Was this page helpful?