c#


WPF multiple thread communication


I create my own routeevent follow the link
here is my code //RaiseShowHardInfoEvent() is called by a workthread
class Hard:UIElement
{
public static readonly RoutedEvent ShowHardInfoEvent = EventManager.RegisterRoutedEvent
("ShowHardInfo", RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(Hard));
// Provide CLR accessors for the event
public event RoutedEventHandler ShowHardInfo
{
add { AddHandler(ShowHardInfoEvent, value); }
remove { RemoveHandler(ShowHardInfoEvent, value); }
}
// This method raises the Tap event
public void RaiseShowHardInfoEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(Hard.ShowHardInfoEvent,this);
RaiseEvent(newEventArgs);
}
I try to response the event in my GUI thread
public partial class MainWindow : Window
{
ThreadStart threadDelegate;//= new ThreadStart(w.DoMoreWork);
Thread threadhard;// = new Thread(new ThreadStart(ThreadProc));
Hard hardins = new Hard();
HardInfoForm m_harinfoForm = new HardInfoForm();
public MainWindow()
{
threadDelegate= new ThreadStart(hardins.ThreadRun);
threadhard = new Thread(threadDelegate);
InitializeComponent();
threadhard.Start();
this.AddHandler(MainWindow.ShowHardInfoEvent, new RoutedEventHandler(this.ShowHardInfo2));
}
private void ShowHardInfo2(object sender, RoutedEventArgs e)
{
m_harinfoForm.Show();
}
}
i am quiet sure i called RaiseShowHardInfoEvent() in workthread
,however the breakpoint at m_harinfoForm.Show() never shoot

Related Links

visual studio: cannot get full list of properties of a build configuration
Sub-sub-Treeview (WPF)
Randomly Choose A Windows Form Control
Calling Twilio API from C#/.NET through a Proxy Server
Progress Bar in Theme
Updating Database Using Dapper
How to rotate player object via script in Unity
How to play a mp3 in monogame
Why, after owin implementation, swagger not work?
Scroll grid with buttons- how to prevent button elements from firing while scrolling
How to make my game engine faster (GDI+, C#)
C# WPF WrapPanel Issue
LINQ - Fetch items from list starting from specific index
Retrieve the GUID present in the Xml file for all message contains the text "Fixed and store them using c#
Explanation for interesting phenomenom with Random() and colors
C# Including large readonly arrays in Windows Forms

Categories

HOME
oauth-2.0
joomla
internet-explorer
javafx
url
jenkins-pipeline
formatting
weblogic
webvr
nagios
cryengine
nltk
xss
psexec
country-codes
http-status-codes
jetbrains
drush
minimum
greensock
windows-phone
novacode-docx
xforms
minimagick
datazen-server
multipart
wai-aria
concatenation
devexpress-mvc
functional-dependencies
gsuite
my.cnf
symlink
ballerinalang
angular2-changedetection
hierarchical-data
dynamic-memory-allocation
r-factor
foxpro
ios-autolayout
ibm-bpm
choco
storefront
zimbra
mootools
powerbi-embedded
sampling
mongoid5
matrix-multiplication
rbac
paperclip
binary-decision-diagram
taleo
anonymous-function
jenkins-2
emacs24
ng-class
playframework-2.3
sp
r-commander
multi-select
acceleo
msiexec
alarmmanager
easy-thumbnails
toggleclass
tinybox2
geokit
change-password
android-xmlpullparser
nimbus
cexception
factorization
jsondoc
markerspiderfier
nonblocking
angular-promise
gitk
serial-communication
notice
personality-insights
bungeecord
conkeror
touch-typing
esri-arc-engine
drools-guvnor
aiff
nsurlrequest
pytz
oxygenxml
disabled-control
django-tests
visual-studio-setup-proje
android-relativelayout
satisfiability
opencobol
nativequery
ardor3d
xrandr
kademlia
wordbreaker
nx
mail-gem
flatten
pdf-reader
parallel-python
mismatch
excellibrary
lgpl
nscharacterset
for-xml
newspeak
large-data-volumes
manuals
wtsapi32
qlibrary
cross-cutting-concerns

Resources

Encrypt Message