private void OnUiThread(OnUiThreadDelegate onUiThreadDelegate) { if (Deployment.Current.Dispatcher.CheckAccess()) { onUiThreadDelegate(); } else { Deployment.Current.Dispatcher.BeginInvoke(onUiThreadDelegate); } }
protected void OnUiThread(OnUiThreadDelegate onUiThreadDelegate) { // Are we on the Dispatcher thread ? if (Deployment.Current.Dispatcher.CheckAccess()) { onUiThreadDelegate(); } else { // We are not on the UI Dispatcher thread so invoke the call on it. Deployment.Current.Dispatcher.BeginInvoke(onUiThreadDelegate); } }