internal static void SetRestoreFocusFields(HwndSource source, object restoreFocus, IntPtr restoreFocusWindow) { object fieldValue = FocusHelper.GetFieldValue(FocusHelper.GetFieldValue((object)source, "_keyboard"), "_value"); if (fieldValue == null) { return; } FocusHelper.SetFieldValue(fieldValue, "_restoreFocusWindow", (object)restoreFocusWindow); FocusHelper.SetFieldValue(fieldValue, "_restoreFocus", restoreFocus); }
internal static void ClearRestoreFocusWindowIf(HwndSource source, Predicate <IntPtr> predicate) { object fieldValue1 = FocusHelper.GetFieldValue(FocusHelper.GetFieldValue((object)source, "_keyboard"), "_value"); if (fieldValue1 == null) { return; } object fieldValue2 = FocusHelper.GetFieldValue(fieldValue1, "_restoreFocusWindow"); if (!(fieldValue2 is IntPtr)) { return; } IntPtr num = (IntPtr)fieldValue2; if (!(num != IntPtr.Zero) || !predicate(num)) { return; } FocusHelper.SetFieldValue(fieldValue1, "_restoreFocusWindow", (object)IntPtr.Zero); }