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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:33:37+00:00 2026-05-27T20:33:37+00:00

I am using the dispatcher in a my function, the function does some work,

  • 0

I am using the dispatcher in a my function, the function does some work, some work needs the dispatcher and some does’t.

For example

this.Dispatcher.BeginInvoke(delegate()
{
    MessageBoxResult result = MessageBox.Show("Are you sure to do this?", MessageBoxButton.OKCancel);
    if (result == MessageBoxResult.OK)
    {
            busyIndicator.Visibility = Visibility.Visible;
            int add = 3 +4;
            string str = "some string";
            this.CallofSomeFunction(arguments);
            this.CallofAnOtherFunction(arguments);
    }
});

In this example the message box needs the dispatcher. The fist called function don’t need the dispatch and in side the second the other message box need the dispatcher.

For all this I have placed all the code in a single dispatcher. Is this approach fine??? or should I use the dispatcher where it is needed??

If the end result is placed on UI. Then should I do all the things in dispatcher (getting result + displaying in UI) or should only place displaying the result in UI in dispatcher.

  • 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-27T20:33:38+00:00Added an answer on May 27, 2026 at 8:33 pm

    Usually it is a good practise to use Dispatcher only for those tasks which are related to UI. If there is something that can be run without UI thread then why keep UI thread busy for this?

    If the end result is placed on UI. Then should I do all the things in dispatcher (getting result + displaying in UI) or should only place displaying the result in UI in dispatcher.

    It depends. End result is going to be displayed through UI Thread or dispatcher but if the intermediate code can take long then you should move this code to a background thread and finally use dispatcher to update UI

    You should always remember the end goal. End goal is to give a better user experience and no freezing UI. If you can do it without background threads then fine but if your business logic takes time it is always good to use background threads

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

Sidebar

Related Questions

I want to create such object in Java that will contain some dispatcher function
I've got a little problem using WPF Dispatcher Timer. On each timer tick my
I'm creating a styled QTreeView using double-dispatch to resolve specific delegate for data items,
In the example for coding with Json using Databinder Dispatch Nathan uses an Object
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I am using Func<> or Action<>.BeginInvoke to run methods asynchronously using the ThreadPool. Is
Currently, I am using xdebug profiler & KCacheGrind . But GallGrind format does not
This is my ajax function: function ajax_call(call_method,data_to_send) { logger(function ajax_call. var data_to_send: ); logger(data_to_send);
When exactly does the compiler create a virtual function table? 1) when the class
I am considering using virtual inheritance in a real-time application. Does using virtual inheritance

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.