private void JoinRequest_Dispatch(object sender, JoinRequest_DispatchDelegateArgs args) { string trace_msg = "Join request: from: " + args.pilot; Trace.WriteLine(trace_msg); AddPilot(args.pilot); }
/////////////////////////////////////////////////////////////////////// public void Join(string pilot) { // NOTE: See "Callback Dispatch Comments" for explanation of the dispatch pattern and why it is needed. // Bundle up the arguments. JoinRequest_DispatchDelegateArgs args = new JoinRequest_DispatchDelegateArgs(pilot); // Delegate the work such that the UI thread of the game_stage calls the XXX_Dispatch() method // to do the actual work. _game_stage.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new JoinRequest_DispatchDelegate(JoinRequest_Dispatch), this, new object[] { args }); }