c# - wpf not refresh code if not focused -


I have this situation: A class that contains a background worker who does something in a while:

Public Sector CControls {Public Representative Zero ControlChangedEventHandler (); Public Event ControlChangedEventHandler ControlChangedEvent; Private readonly background worker; Bull B Close = false; Public CControls (IntPtr hwnd) {worker = new BackgroundWorker (); Worker.DoWork + = worker_DoWork; Worker.RunWorkerCompleted + = worker_RunWorkerCompleted; } Zero worker_recognito full (object sender, runwalker, complete, and E. e) {bclose = true; } Public zero enabled {bEnable & amp;! Worker.IsBusy} {worker.RunWorkerAsync (); } Else {bClose = true; }} Void worker_DoWork (Object Sender, DoWorkEventArgs e) {while (! BClose) {// My job // .......................... .................... // if (ControlChangedEvent! = Zero) {ControlChangedEvent (); }}}}

I have my forms that make an example of this class and set the listener of ControlChangedEvent :

  CControls CT = new CControls (); Ct.ControlChangedEvent + ct_ControlChangedEvent; Int change = 0; Zero ct_ControlChangedEvent () {Dispatcher.Invoke (DispatcherPriority.Background, (Action) representative {changes ++; infoLabel.Content = string.Format ("change: {0}", change);}); }  

But infoLabel only changes when the focus of my program is done, otherwise it is not removed ...

Any ideas? Thanks;)


Comments

Popular posts from this blog

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -