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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:26:24+00:00 2026-05-23T20:26:24+00:00

I working on a project(C# & WPF) where some servers are added to a

  • 0

I working on a project(C# & WPF) where some servers are added to a listbox this way:

ObservableCollection<ServerObjects> servers;
ServerObjects so = getServers();
servers->add(so);

My problem is that this function is blocking and while items are added to my listbox, I can’t select any only after the generating is done(also the program frezes).

So any idee what should I do to make this function asynk?

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-23T20:26:25+00:00Added an answer on May 23, 2026 at 8:26 pm
    void addServers(ObservableCollection<ServerObjects> ACollection)
    {
        //For Common szenarios dont use new Thread() use instead ThreadPool.QueueUserWorkItem(..) or  the TaskFactory
        Task.Factory.StartNew(()=> this.LoadServer());
    }
    
    void MyThreadMethod(Object obj)
    {
        ServerObjects so = getServers();
    
        // The invoke is important, because only the UI Thread should update controls or datasources which are bound to a Control
        UIDispatcher.Invoke(new Action(()=> (obj as ObservableCollection).add(so));
    }
    

    You can do is also on RX return an IObservable subscribe on TaskScheduler and observing on Dispatcher.

    -> Threadpool vs.s Creating own Thread
    -> Build More Responsive Apps With The Dispatcher

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

Sidebar

Related Questions

I'm working on this project and I need to add this functionality where we
My team working in a project using Winforms application(c#) & MSSQL 2005 as database.
A project I am working on uses Spring 2.5 & JPA with Hibernate as
I working on project and have problem with threading and update of UI. I
I'm currently working on project with Haskell, and have found myself some trouble. I'm
I'm working on project that lets users choose some scientific authors and columnists and
I am working on a project with RL & NN I need to determine
I am working on project for controlling some devices through lpt port. I am
I'm working on a project that gets callbacks from some other sites' API. I
I have built a Wpf-ControLibrary-Project to put some Controls there. In one Control i

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.