Esempio n. 1
0
        private void OnFuncClicked(object sender, RoutedEventArgs e)
        {
            Func <Task <string> >  funcTask  = DisplayMessageTask;
            MyTaskGeneric <string> myGeneric = new MyTaskGeneric <string>(funcParam);
            string res = myGeneric.Continue(funcTask).Result;

            DisplayMessage(res);
        }
Esempio n. 2
0
        private void OnFuncTaskTaskTClicked(object sender, RoutedEventArgs e)
        {
            Action act = () =>
            {
                MessageDialog msgD = new MessageDialog("Display message TaskTask so on.",
                                                       "Thread ID: " + Environment.CurrentManagedThreadId.ToString());
                msgD.ShowAsync();
            };
            Task taskParam = new Task(act);
            Func <Task, Task <string> > funcTask  = DisplayMessageTaskTaskT;
            MyTaskGeneric <string>      myGeneric = new MyTaskGeneric <string>(funcParam);
            Task <string> res = myGeneric.Continue(funcTask);

            DisplayMessage(res.Result);
        }