Esempio n. 1
0
 /// <exception cref="Exception">A delegate callback throws an exception.</exception>
 public StreamPageViewModel(T repository)
 {
     _repository      = repository;
     InitializeAsync += OnInitializeAsync;
     if (InitializeAsync != null)
     {
         InitializeAsync.Invoke();
     }
 }
Esempio n. 2
0
        public async void AsyncAwaitExercise13_Click(object sender, RoutedEventArgs e)
        {
            Output("Exercise 13");

            // Exercise 13 - Constructor Task
            // There is no async constructor (and there shouldn't be)
            // One option is to create an initialize method
            // This shows how you can "hide" this initialize

            var initAsync = new InitializeAsync();

            await initAsync.DoWork();

            Output("Exercise 13...");

            // Notice the second time we call we don't
            // execute the Task.Delay
            await initAsync.DoWork();

            Output("Exercise 13 Done");
        }