Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 603861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:58:37+00:00 2026-05-13T16:58:37+00:00

I have a web service with two methods: RetrieveFirstLevelOptions() and RetrieveSecondLevelOptions(int levelOneOption). The GUI

  • 0

I have a web service with two methods:

RetrieveFirstLevelOptions() and RetrieveSecondLevelOptions(int levelOneOption).

The GUI contains two comboBoxes: FirstLevelOptionsCombo and SecondLevelOptionsCombo.

I am having trouble with creating a control flow for the initialization stage when I have to make a request to RetrieveFirstLevelOptions() and then, once the results are in, call RetrieveSecondLevelOptions(default levelOneOption = 0).

The problem is that since everything happens asynchronously I don’t know what the best approach is to allow this behaviour take place once and only once, at the beginning.

An option I would love to have is to attach a second event handler to the RetieveFirstLevelOptionsCompleted event and have it remove itself after running only once. But it looks like such a behaviour is impossible to get.

Another option would be to have a boolean flag to indicate whether in Initialization phase and if it is, then the handler for RetrieveFirstLevelOptionsCompleted would execute some additional logic. However this idea makes it look like all event handlers would have to check for state information and do different things depending on the current state. This seems to be bad design because the control flow seems to be descentralized.

I want to have a centralized control flow mechanism that will make the decisions in one spot. But how can this be done when everything is executed asynchronously?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:58:37+00:00Added an answer on May 13, 2026 at 4:58 pm

    “An option I would love to have is to attach a second event handler to the RetieveFirstLevelOptionsCompleted event and have it remove itself after running only once. But it looks like such a behaviour is impossible to get.”

    Is there some reason this isn’t working:

    class Example
    {
        SomeWebService myService;
    
        Example()
        {
            // do stuff
            myService.RetrieveFirstLevelOptionsCompleted += MyHandlerMethod;
        }
    
        void MyHandlerMethod(object sender, RetrieveFirstLevelOptionsCompletedEventArgs e)
        {
            // do stuff
            myService.RetrieveFirstLevelOptionsCompleted -= MyHandlerMethod;
            // potentially attach next event handler for all subsequent calls
            myService.RetrieveFirstLevelOptionsCompleted += MyHandlerMethod2;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service which has two methods exposed: Note: The wcf service
The SharePoint web service usergroup.asmx has two methods to add role definitions to a
I have a custom web service deployed into WSS 3. It has two web
I have two webservices that have exactly the same methods and signatures but point
I have a web-service that I will be deploying to dev, staging and production.
I have a web service that I created in C# and a test harness
I have a web service (ASMX) and in it, a web method that does
I have a web service that queries data from this json file, but I
I have a web service that uses Python's SimpleJSON to serialize JSON, and a
I have a web service that is protected by requiring the consuming third party

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.