예제 #1
0
        private Task <string> Download(string name)
        {
            _Download_d__2 stateMachine = new _Download_d__2();

            stateMachine.__4__this    = this;
            stateMachine.name         = name;
            stateMachine.__t__builder = AsyncTaskMethodBuilder <string> .Create();

            stateMachine.__1__state = -1;
            AsyncTaskMethodBuilder <string> __t__builder = stateMachine.__t__builder;

            __t__builder.Start(ref stateMachine);
            return(stateMachine.__t__builder.Task);
        }
예제 #2
0
            private void MoveNext()
            {
                int    num = __1__state;
                string result;

                try
                {
                    TaskAwaiter awaiter;
                    if (num != 0)
                    {
                        awaiter = Task.Delay(1000).GetAwaiter();
                        if (!awaiter.IsCompleted)
                        {
                            num    = (__1__state = 0);
                            __u__1 = awaiter;
                            _Download_d__2 stateMachine = this;
                            __t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
                            return;
                        }
                    }
                    else
                    {
                        awaiter = __u__1;
                        __u__1  = default(TaskAwaiter);
                        num     = (__1__state = -1);
                    }
                    awaiter.GetResult();
                    result = DateTime.Now.ToString();
                }
                catch (Exception exception)
                {
                    __1__state = -2;
                    __t__builder.SetException(exception);
                    return;
                }
                __1__state = -2;
                __t__builder.SetResult(result);
            }