当前位置: 首页>>代码示例>>C#>>正文


C# AsyncResult.SetComplete方法代码示例

本文整理汇总了C#中AsyncResult.SetComplete方法的典型用法代码示例。如果您正苦于以下问题:C# AsyncResult.SetComplete方法的具体用法?C# AsyncResult.SetComplete怎么用?C# AsyncResult.SetComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AsyncResult的用法示例。


在下文中一共展示了AsyncResult.SetComplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WhenCompleted_ThenESetsResult

        public void WhenCompleted_ThenESetsResult()
        {
            var result = new AsyncResult<object>(null, null);

            result.SetComplete(this, true);

            Assert.AreSame(this, result.Result);
        }
开发者ID:eslahi,项目名称:prism,代码行数:8,代码来源:AsyncResultFixture.cs

示例2: WhenCompletedSynchronouslyWithNoCallback_ThenUpdatesCompletionStatus

        public void WhenCompletedSynchronouslyWithNoCallback_ThenUpdatesCompletionStatus()
        {
            var result = new AsyncResult<object>(null, null);

            result.SetComplete(null, true);

            Assert.IsTrue(result.IsCompleted);
            Assert.IsTrue(result.CompletedSynchronously);
        }
开发者ID:eslahi,项目名称:prism,代码行数:9,代码来源:AsyncResultFixture.cs

示例3: WhenCompleted_ThenExecutesCallback

        public void WhenCompleted_ThenExecutesCallback()
        {
            bool executed = false;
            var result = new AsyncResult<object>(ar => executed = true, null);

            result.SetComplete(null, true);

            Assert.IsTrue(executed);
        }
开发者ID:eslahi,项目名称:prism,代码行数:9,代码来源:AsyncResultFixture.cs

示例4: BeginGetEmailDocuments

        public IAsyncResult BeginGetEmailDocuments(AsyncCallback callback, object userState)
        {
            var asyncResult = new AsyncResult<IEnumerable<EmailDocument>>(callback, userState);
            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    asyncResult.SetComplete(new ReadOnlyCollection<EmailDocument>(this.emailDocuments), false);
                });

            return asyncResult;
        }
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:11,代码来源:EmailService.cs

示例5: BeginGetContacts

        public IAsyncResult BeginGetContacts(AsyncCallback callback, object userState)
        {
            var asyncResult = new AsyncResult<IEnumerable<Contact>>(callback, userState);
            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    asyncResult.SetComplete(CreateContacts(), false);
                });

            return asyncResult;
        }
开发者ID:jbanks27,项目名称:Prism-Samples-Wpf,代码行数:11,代码来源:ContactsService.cs

示例6: BeginSubmitQuestionnaire

        public IAsyncResult BeginSubmitQuestionnaire(Questionnaire questionnaire, AsyncCallback callback, object userState)
        {
            var asyncResult = new AsyncResult<object>(callback, userState);
            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    // simulated processing time
                    Thread.Sleep(2000);

                    if (!FailOnSubmit)
                    {
                        asyncResult.SetComplete((object)null, false);
                    }
                    else
                    {
                        asyncResult.SetComplete(new InvalidOperationException("Not authorized"), false);
                    }
                });

            return asyncResult;
        }
开发者ID:eslahi,项目名称:prism,代码行数:21,代码来源:QuestionnaireService.cs

示例7: BeginGetQuestionnaireTemplateSummary

        public IAsyncResult BeginGetQuestionnaireTemplateSummary(QuestionnaireTemplate questionnaireTemplate, AsyncCallback callback, object userState)
        {
            var asyncResult = new AsyncResult<QuestionnaireTemplateSummary>(callback, userState);
            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    Thread.Sleep(1500);
                    asyncResult.SetComplete(CreateQuestionnaireTemplateSummary(questionnaireTemplate), false);
                });

            return asyncResult;
        }
开发者ID:eslahi,项目名称:prism,代码行数:12,代码来源:QuestionnaireService.cs

示例8: BeginSendEmailDocument

        public IAsyncResult BeginSendEmailDocument(EmailDocument email, AsyncCallback callback, object userState)
        {
            var asyncResult = new AsyncResult<object>(callback, userState);
            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    Thread.Sleep(500);
                    asyncResult.SetComplete(null, false);
                });

            return asyncResult;
        }
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:12,代码来源:EmailService.cs

示例9: BeginSubmitResponses

        public IAsyncResult BeginSubmitResponses(Questionnaire questionnaire, AsyncCallback callback, object asyncState)
        {
            var result = new AsyncResult<object>(callback, asyncState);

            ThreadPool.QueueUserWorkItem(
                state =>
                {
                    DoSubmitResponses(questionnaire);
                    result.SetComplete(null, false);
                });

            return result;
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:13,代码来源:QuestionnaireService.cs

示例10: BeginGetQuestionnaire

        public IAsyncResult BeginGetQuestionnaire(AsyncCallback callback, object asyncState)
        {
            AsyncResult<Questionnaire> asyncResult = new AsyncResult<Questionnaire>(callback, asyncState);

            ThreadPool.QueueUserWorkItem(
                state =>
                {
                    var questionnaire = DoGetQuestionnaire();
                    asyncResult.SetComplete(questionnaire, false);
                });

            return asyncResult;
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:13,代码来源:QuestionnaireService.cs

示例11: BeginFindAll

        public IAsyncResult BeginFindAll(AsyncCallback callback, object asyncState)
        {
            AsyncResult<Users> asyncResult = new AsyncResult<Users>(callback, asyncState);

            ThreadPool.QueueUserWorkItem(
                state =>
                {
                    var users = this.FindAllUsersAsync();
                    asyncResult.SetComplete(users, false);
                });

            return asyncResult;
        }
开发者ID:rcrosbourne,项目名称:gymsoft-membership-manager,代码行数:13,代码来源:UserMockService.cs

示例12: WhenInvokingEndBeforeCompletion_ThenBlocksUntilComplete

        public void WhenInvokingEndBeforeCompletion_ThenBlocksUntilComplete()
        {
            var result = new AsyncResult<object>(null, null);
            bool pre = false;
            bool post = false;

            ThreadPool.QueueUserWorkItem(
                o =>
                {
                    pre = true;
                    AsyncResult<object>.End(result);
                    post = true;
                });

            EnqueueConditional(() => pre);

            EnqueueCallback(
                () =>
                {
                    Assert.IsFalse(post);
                    result.SetComplete(null, false);
                });

            EnqueueConditional(() => pre);

            EnqueueTestComplete();
        }
开发者ID:eslahi,项目名称:prism,代码行数:27,代码来源:AsyncResultFixture.cs

示例13: WhenInvokingEndForTheWrongAsyncResultType_ThenThrowsException

        public void WhenInvokingEndForTheWrongAsyncResultType_ThenThrowsException()
        {
            var result = new AsyncResult<object>(null, null);

            result.SetComplete(null, false);

            try
            {
                AsyncResult<int>.End(result);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
            }
        }
开发者ID:eslahi,项目名称:prism,代码行数:15,代码来源:AsyncResultFixture.cs

示例14: ProceedGetQuestionnaireTemplateSummary

 public void ProceedGetQuestionnaireTemplateSummary(AsyncResult<QuestionnaireTemplateSummary> result, QuestionnaireTemplateSummary questionnaireTemplateSummary)
 {
     result.SetComplete(questionnaireTemplateSummary, false);
 }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:4,代码来源:MockQuestionnaireService.cs

示例15: ProceedSubmitResponses

 public void ProceedSubmitResponses(AsyncResult<object> result)
 {
     result.SetComplete(null, false);
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:4,代码来源:MockQuestionnaireService.cs


注:本文中的AsyncResult.SetComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。