BeginInvoke with Delegate Function

  • Thread starter Thread starter zequion1
  • Start date Start date
Z

zequion1

Guest
Because if I use Invoke the program freezes, I am trying to use BeginInvoke but the control must be available to update the value and I pass a parameter by reference.
How i do it? This code doesn't work:


public delegate dynamic Fcn_ThRControl(dynamic ThRControl, dynamic Param1, ref dynamic Param2, dynamic Param3);

public static dynamic Fcn_Control(dynamic ThRControl, dynamic Param1, ref dynamic Param2, dynamic Param3)
{ dynamic MyDyn = null;

if(!ThRControl.Dispatcher.CheckAccess()) return ThRControl.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Fcn_ThRControl(Fcn_Control), new object[]{ ThRControl, Param1, Param2, Param3 });


ThRControl.Text = "My Text";
return MyDyn;
}

Continue reading...
 
Back
Top