Beispiel #1
0
 private void GetAllMovies()
 {
     try
     {
         Task t = Task.Run(async() =>
         {
             _moviesList = await MovieManagement.MovieManagement.GetAllMoviesAsync(_moviesList);
         });
         TimeSpan ts = TimeSpan.FromMilliseconds(60000);
         if (!t.Wait(ts))
         {
             Debug.WriteLine("Timeout.");
             MessageBox.Show("A timeout occurred");
             Task t2 = Task.Run(async() =>
             {
                 await Logout.LogoutAsync();
             });
             TimeSpan ts2 = TimeSpan.FromMilliseconds(1000);
             Mediator.Mediator.Notify("GoToLogin", "");
         }
         if (_moviesList != null)
         {
             Mediator.Mediator.Notify("MovieCache", _moviesList);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         MessageBox.Show("An error occurred");
     }
 }