• (2 Pages)
  • +
  • 1
  • 2

The Background Worker How to use a background worker. Rate Topic: ***** 2 Votes

#16 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon

Reputation: 2289
  • View blog
  • Posts: 9,528
  • Joined: 29-May 08

Posted 31 May 2013 - 12:24 AM

macosxnerd101: Let me have swing at it or them first.


Why does this article contain countless sentence fragments that make no sense?
Is the English?

U sum sorta gramma nazi?
Are you prejudiced against Dyslexic content creators?

Further more which version are you comparing to? The Queen's English, American English, Estuary English, Ye Olde World English, Shakespearean or an accented English? like Yorkshire. which even has sub dialects for example the Barnsley (from where I originate) accent. I think in Barnsley and have to first translate the to whatever this "standard" English.

Combine that with other problems I suffer from like Dyslexia, Audio Processing Disorder (difficulty differentiating the phonemes of language) and Irlen syndrome. It can be physical and mentally exhausting, as well as frustrating. Since there a big disjuncture in my mental and intelligence capabilities and what I physical produce. Compared with to other I can seem like I'm lazy because it take me a disproportionate amount of time to produce comparable content.

Spell check can only check the spelling of the words. Correct contextual usage is harder to see, especially for me. The tutorial was created in 2009 and has had a minimum of 105K of views. I think it is actually a lot more since the we (DIC) has a forum upgrade that reset them, and the tutorial existed before that. If you were to take the time to investigate (which I suspect you wouldn't) and review the progression of the tutorials. I believe you find that they improve, since only generating and writing content will improve your quality of them.

Do you speak from a voice of authority? By which I mean a content producer.
What content have you produced?
Can we see it?
Are you willing to place yourself and the content you produce on to the sacrificial alter of the internet.
To be under the knife of a high priest of the church of the flying spaghetti monster for your linguistic fails.


Why is the huge, complex mess of code needed?

A lot of the complexity arises from the threading model used in Windows and the cross thread communications and the marshaling of data across them. The thread on which GUI control is created on, is the owner of it. Since the background worker uses internally a separate thread to enable simultaneous operation with the GUI thread, delegates are need to access controls on the form(s).

You can always create a new thread yourself. Or if you are use a new version of .net (.net 4.0 or later) the use tasks, but this still involve cross thread communications and the use of delegates.


If MS wanted us to use this extremely common feature: Run This Code In The Background

Common feature where?


Why can't the entire mess just be one line of code:
Call RunInTheBackground(mySubName)


First point, use the code tags for code or use the il tag for small single line code example.
Or didn't you read the background text of, or that big yellow box above the reply box?

Are you a vb6 coder? Call {method name} isn't required in vb.net.


Sheezess. I can't invest all this time, coding, and debugging...

Why are you even bothering then?
Debugging Skills are essential to learn, your code isn't going to be perfect.


... just to do something that should ALREADY
be a built-in call.

Your complaining to me, because your frustrated that you can't understand or use it.

It is already a built in call, you just don't know how to use it because you haven't invested the time to read the publicly available documentation (MSDN), or even do a little experimentation.

There are multiple ways to do it. All of which boil down to Threads and Tasks
Do you want synchronous or asynchronous results?

Which way is best for your situation is done to you to decide, which one meets you requirements.
You are the one doing the engineering for your project.

Microsoft ain't psychics who can predict the intent of you code.

vb.net is a descended from vb6 which is single threaded, if you wanted it you write the multi-thread usage yourself. It was even more complex.

Also multi-threaded code incurs a cost (it could even be slower), and is inherently non-deterministic.
So is hard to get get use to, thus hard do correctly.

X = X + 1 or X += 1 isn't thread safe.

You need to use Interlocked.Increment(X).

Multiple access to shared resource need coordination and control, is that via Locks or mutexes or some other synchronization mechanism?

For a large majority of the use cases it isn't even needed.

This post has been edited by AdamSpeight2008: 31 May 2013 - 12:40 AM

Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2