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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:09:03+00:00 2026-05-26T09:09:03+00:00

Here is my target: the app consists of an form – MainForm – which

  • 0

Here is my target: the app consists of an form – MainForm – which contains a lot of tabs (Notepad++ GUI-like). Each tab is an UserControl descendant (UCDx). MainForm can display 2 or more tabs which contain instances of the same UCDx. The target is that UCDx will have to perform some time-consuming actions or method executions – i.e. DB read/write, Web Service methods calls. This kind of actions I’d want to run in separate threads, in order not to freeze UI. Also I’ll need to implement an info form (InfoForm) – which will show info upon current running threads, with some interaction functionality – i.e. close threads that runs too long.

The main problems I faced are:

  • thread interaction with GUI – i.e. an thread reads data which should be displayed in a grid;
  • thread interaction managing – upon implementing InfoForm.

In concurent/paralel programming I’m beginner – can someone give some clues upon how to implement that?

  • 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-26T09:09:03+00:00Added an answer on May 26, 2026 at 9:09 am

    I would first separate your worker logic from the UI.

    For example, for a “thread which needs to read data and display it”, try to split your problem into smaller pieces:

    1. Create a plain class which has a synchronous processing method, no threading involved. Something like:

      interface IServiceReader
      {
           Data GetDataFromService(IServiceInfo info);
      }
      
    2. Test it. Create unit tests, or even a small console app where you can see that it works fine without a GUI.

    3. Create an async wrapper class, which calls the ServiceReader to do the job, but calls it on a background thread, and fires an event when done.

      interface IAsyncServiceReader
      {
           void Start(IServiceInfo info);
           event EventHandler<Data> DataReceived;
      }
      
    4. Again, test it. This should be a separate class library, independent of your GUI.

    5. Use MVC or similar pattern to separate your views (tabs) from your model (async service reader). This means you should fire interaction events from your views, handle them in controller, and then let controller call the appropriate action in the model:

      class Controller
      {
           readonly ITabView _view; 
           readonly IAsyncServiceReader _model;
           public Controller(ITabView view, IAsyncServiceReader model)
           {
                _view = view; _model = model;
                AttachHandlers();
           }
      
           void AttachHandlers()
           {
                view.UserRequestedLoading += (sender,info) => model.Start(info);
                model.DataReceived += (sender,data) => view.DisplayData(data);
           }
      }
      
    6. Finally, make sure that background thread calls get dispatched to the right (GUI) thread. This would simply mean your tab view needs to check if invoke is required:

      class TabView : UserControl
      {
           void DisplayData(Data data)
           {
               if (this.InvokeRequired)
               {
                   BeginInvoke(new Action<Data>(DisplayData), data);
                   return;
               }
      
               // otherwise, display the data in some way
               dataGrid.DataSource = data; ...
           }
      }
      

    Separating the model from the view will simplify testing, and later changes to UI. You may decide to make this a console app, or a windows service, and this will keep your business logic intact.

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

Sidebar

Related Questions

To give more information I am using the modular form here: http://jqueryui.com/demos/dialog/#modal-form `b(e.target).zIndex` is
We want to build a smartphone app which uses geolocation, etc. and target the
Here's my predicament. I have an app that I would like to update to
Here's my current scenario which is specifically what i'd like to discuss as a
Here's my code: UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(rightButtonPressed)]; [self.navigationItem setLeftBarButtonItem:leftButton]; [leftButton
Please go here to see an iframe based web app. Click on the map
Here's an obscure problem. I'm using an InfoPlist.strings to localize my app name. It's
i have created an android app using phone-gap[Android]. Here i am able to zoom
I having trouble with app that uses my static libs. Here is my setup:
I'm developing an app for Android in Eclipse. Currently I target API level 3,

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.