private static void HandleCancelRoutine(PacketHeader header, Connection connection, string param) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(delegate { ClientWindow.CancelRoutine(); })); }