Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WPF Dispatcher

Posted on 2010-11-19
2
Medium Priority
?
429 Views
Last Modified: 2012-05-10
Hi
I need som help with this code.

How do I write the Dispatcher for this listbox I have?
private void StatusUpdates(string message)
        {
            if (this.uxStatusUpdate.Dispatcher.Thread == Thread.CurrentThread)
            {
                this.uxStatusUpdate.Items.Add(message);
            }
            else
            {
                this.uxStatusUpdate.Dispatcher.BeginInvoke ????            
            }
        }

Open in new window

0
Comment
Question by:AWestEng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 34177721
Here's one way:
*Note the delegate I declared above StatusUpdates()!
private delegate void StatusUpdatesDelegate(string message);

        private void StatusUpdates(string message)
        {
            if (this.uxStatusUpdate.Dispatcher.Thread == Thread.CurrentThread)
            {
                this.uxStatusUpdate.Items.Add(message);
            }
            else
            {
                this.uxStatusUpdate.Dispatcher.BeginInvoke(new StatusUpdatesDelegate(StatusUpdates), new Object[] { message });
            }
        }

Open in new window

0
 
LVL 1

Author Closing Comment

by:AWestEng
ID: 34179207
thx man
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question