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 6009107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:55:25+00:00 2026-05-23T01:55:25+00:00

I have a simple ChildWindow containing only two elements, textblock and a progress bar

  • 0

I have a simple ChildWindow containing only two elements, textblock and a progress bar to simulate a waiting screen. That ChildWindow is started before calling async WCF method and closed on the callback.

The problem is the second time the ChildWindow is close the entire surface stay disable. I’ve search for similar situation, one blog post talked about the Close method being called two times, that’s not my case.

Here is some sample code (svc is a WCF Services):

// global private class variable
private WaitingScreen wait = new WaitingScreen();

public void DoSomething()
{
  svc.SaveCompleted += (s, arg) =>
  {
    wait.Close();
  };

  wait.Show();
  svc.SaveAsync();
}

Any pointer would be appreciated, I think I’m missing something basic here.

  • 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-23T01:55:26+00:00Added an answer on May 23, 2026 at 1:55 am

    Close method being called two times, that’s not my case.

    I think it probably is. Consider having called DoSomething twice how many delgates have been assigned to the SaveCompleted and how many have been removed? Answer: 2 have now been added and none removed. Hence when it completes for the second time Close will be called twice in quick succession.

    Try this code which removes the delegate after it has been fired once.

    public void DoSomething()
    {
      var wait = new WaitingScreen();
    
      EventHandler<AsyncCompletedEventArgs> saveCompleted = null;
    
      saveCompleted  = (s, arg) =>
      {
        wait.Close();
        svc.SaveCompleted -= saveCompleted;
      };
    
      svc.SaveCompleted += saveCompleted;
      wait.Show();
      svc.SaveAsync();
    }
    

    Having said all that I agree with @zapico use the toolkit BusyIndicator for this task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple win service, that executes few tasks periodically. How should I pass
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
I have simple WinForms application where modifying Windows Registry. The problem is that in
I have a quite simple scenario that I cannot get to work correctly. I
i have simple table with two fields: ID and Date how can i do
I have simple login form in my website. In given requirements stands, that password
I have simple class Point with two fields of type double . I asked
I have simple remoting API that has method similar to this: bool FillMyList(List<string> ListToFill)
Simple question, I have a window that was opened with this code window.open(URL, windowName,
I have simple WCF Service Application (based on this tutorial : Getting Started ).

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.