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

  • SEARCH
  • Home
  • 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 5956215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:13:30+00:00 2026-05-22T18:13:30+00:00

My scenario at a high level is the following: Application loads and caching of

  • 0

My scenario at a high level is the following:

Application loads and caching of data that never is going to change starts, for this I do batches of 5 threads that do a call to a WCF service.

If the service is down I’ll get a popup informing the user that there was a communication error and ask whether he wants to retry or cancel the operation (this logic happens inside the thread that is making the service call, which doesn’t care/know of any other running threads).

As I’m doing 5 calls at once and the service is down, I’ll get asked 5 consecutive times about if I want to retry the operation or cancel it.

What I’d like to do is: as I’m showing the same question only ask the user once and return the same result to all waiting threads. Any ideas on how to achieve this? It sounds as a bad idea so I’m also open to hear other ways to achieve the same behaviour.

public string Show(string key, Action<DialogBuilder> action)
{
    lock (this) //now 4 threads are waiting here
    {       
         //marshal the dialog to the UI thread  
         return _dispatcher.Send(() => new MyDialogForm().ShowDialog()); 
    }
}

Thanks!

  • 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-22T18:13:31+00:00Added an answer on May 22, 2026 at 6:13 pm

    Just cache the dialog result and provide it to all other dialogs like this (below code may need some tweaking as I wrote it in notepad):

    private DialogResult threadedDialogResult;
    private bool dialogShown;
    
    public string Show(string key, Action<DialogBuilder> action)
    {
        lock (this) //now 4 threads are waiting here
        {
            if (!dialogShown)
            {
                //marshal the dialog to the UI thread  
                return _dispatcher.Send(() => { dialogShown = true; this.threadedDialogResult = new MyDialogForm().ShowDialog(); });
            }
            else
            {
                // Use the cached dialog result as we know it was shown
                return threadedDialogResult.ToString();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a generic question that applies to (probably) any high-level programming language. Here
Scenario: Most smartphones have a high resolution camera that generates photos that may range
We have a very high performance multitasking, near real-time C# application. This performance was
In subsystem design, I sometimes see software designs that have one high-level class that
I'm looking for a high-level, algorithmic understanding so that I can get a Big-O
A simple scenario. User logs in through the form baked by some high level
I am starting to use cucumber for high level testing. I have this defined
This is a high-level question and I am sure there is no universally correct
I'm looking for possible solutions for the following scenario: I have a service that
I have a simple C# application that uses UDP multicast in a single-receiver, single-sender

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.