/// <summary> /// Determines whether two DPI_AWARENESS_CONTEXT values are identical. /// </summary> /// <param name="dpiContextA">The first value to compare</param> /// <param name="dpiContextB">The second value to compare</param> /// <returns>Returns true if the value are equal, otherwise false</returns> /// <remarks> /// <see cref="SafeNativeMethods.AreDpiAwarenessContextsEqual"/> is supported on Windows 10 v1607 /// and later. On Platforms prior to that, we will fall-back to direct comparison of these /// pseudo-handles. /// </remarks> internal static bool AreDpiAwarenessContextsEqual(IntPtr dpiContextA, IntPtr dpiContextB) { if (IsAreDpiAwarenessContextsEqualMethodSupported) { try { return(SafeNativeMethods.AreDpiAwarenessContextsEqual(dpiContextA, dpiContextB)); } catch (Exception e) when(e is EntryPointNotFoundException || e is MissingMethodException || e is DllNotFoundException) { IsAreDpiAwarenessContextsEqualMethodSupported = false; } } return(AreDpiAwarenessContextsTriviallyEqual(dpiContextA, dpiContextB)); }
public bool Equals(DpiAwarenessContextHandle dpiContextHandle) { return(SafeNativeMethods.AreDpiAwarenessContextsEqual(this.DangerousGetHandle(), dpiContextHandle.DangerousGetHandle())); }