diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/MouseDevice.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/MouseDevice.cs index 0bf05bcfd76..1cb4cbfc9e9 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/MouseDevice.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/MouseDevice.cs @@ -1195,7 +1195,7 @@ private void PreProcessInput(object sender, PreProcessInputEventArgs e) } } // Only process mouse input that is from our active PresentationSource. - else if ((_inputSource != null) && (rawMouseInputReport.InputSource == _inputSource)) + else if ((_inputSource is not null) && (rawMouseInputReport.InputSource == _inputSource)) { // We need to remember the StylusDevice that generated this input. Use the _tagStylusDevice // to store this in before we take over the inputReport Device and loose it. Any @@ -1440,7 +1440,7 @@ private void PreNotifyInput(object sender, NotifyInputEventArgs e) } // Only process mouse input that is from our active presentation source. - if ((_inputSource != null) && (rawMouseInputReport.InputSource == _inputSource)) + if ((_inputSource is not null) && (rawMouseInputReport.InputSource == _inputSource)) { // If the input is reporting mouse deactivation, we need // to break any capture we may have. Note that we only do @@ -1888,7 +1888,7 @@ private void PostProcessInput(object sender, ProcessInputEventArgs e) RawMouseInputReport rawMouseInputReport = (RawMouseInputReport) inputReportEventArgs.Report; // Only process mouse input that is from our active visual manager. - if ((_inputSource != null) && (rawMouseInputReport.InputSource == _inputSource)) + if ((_inputSource is not null) && (rawMouseInputReport.InputSource == _inputSource)) { // In general, this is where we promote the non-redundant // reported actions to our premier events. diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenThreadWorker.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenThreadWorker.cs index 4a09bcdc104..7e10a2dc450 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenThreadWorker.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenThreadWorker.cs @@ -208,7 +208,7 @@ protected override void OnDoWork() // so that nothing gets lost during marshalling. The cast from Int64 to Int32 below // should be lossless cast because both COM server and client are expected // to be of same bitness (they are in the same process). - result.CommHandle = IntPtr.Size == 4 ? new IntPtr((int)commHandle) : new IntPtr(commHandle); + result.CommHandle = Environment.Is64BitProcess ? (nint)commHandle : (int)commHandle; result.WispContextKey = MS.Win32.Penimc.UnsafeNativeMethods.QueryWispContextKey(pimcContext); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndMouseInputProvider.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndMouseInputProvider.cs index 0873b573d8c..f27373c1966 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndMouseInputProvider.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndMouseInputProvider.cs @@ -780,7 +780,7 @@ internal IntPtr FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, Int // to this we release capture if we currently have it. try { - if(_source.HasCapture ) + if(_source.HasCapture) { SafeNativeMethods.ReleaseCapture(); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextServicesHost.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextServicesHost.cs index 7e50b7f0292..8ff2f18e88d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextServicesHost.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextServicesHost.cs @@ -328,7 +328,7 @@ private void _RegisterTextStore(TextStore textstore) // Create a TSF document. _threadManager.CreateDocumentMgr(out doc); - doc.CreateContext(_clientId, 0 /* flags */, textstore, out context, out editCookie); + doc.CreateContext(_clientId, flags: 0, textstore, out context, out editCookie); doc.Push(context); // Attach a thread focus sink. diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs index 17e421b3d75..acff8b95a56 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @@ -2409,14 +2409,7 @@ internal bool CriticalRequestProcessing(bool force) return succeeded; } - private bool IsWindowNull() - { - if(_window == null) - { - return true; - } - return false; - } + private bool IsWindowNull() => _window is null; private bool RequestForegroundProcessing() {