public static void GoBabyGo() { Dispatcher dispatcher; if (Application.Current == null) { if (!SnoopModes.MultipleDispatcherMode) { dispatcher = Dispatcher.CurrentDispatcher; } else { // can't find a dispatcher return; } } else { dispatcher = Application.Current.Dispatcher; } if (dispatcher.CheckAccess()) { var zoomer = new Zoomer(); zoomer.Magnify(); } else { dispatcher.Invoke(GoBabyGo); } }
private void HandleMagnify(object sender, ExecutedRoutedEventArgs e) { var zoomer = new Zoomer(); zoomer.Magnify(Target); e.Handled = true; }