Kaynağa Gözat

尝试修复键盘监听在另一台魔盒上失效的问题,更新WingDll

felix 1 yıl önce
ebeveyn
işleme
f876982ea2

+ 1 - 1
FISSDK/FISSDK/PipeClient.cs

@@ -9,9 +9,9 @@ namespace FISLib
     {
         private readonly NamedPipeClientStream _pipeClient;
         private readonly object _lock = new object();
+        private readonly CancellationTokenSource _cts;
 
         private Task _task;
-        private CancellationTokenSource _cts;
         private int _retryCount;
         private bool _disposed;
 

+ 2 - 2
FISSDK/FISSDK/PipeServer.cs

@@ -8,12 +8,12 @@ namespace FISLib
     public class PipeServer : IDisposable
     {
         private readonly NamedPipeServerStream _pipeServer;
+        private readonly CancellationTokenSource _cts;
+        private readonly byte[] _currentLengthArray;
 
-        private CancellationTokenSource _cts;
         private Task _task;
         private bool _disposed;
         private byte[] _currentByteArray;
-        private byte[] _currentLengthArray;
 
         /// <summary>
         /// Gets the pipe name.

+ 1 - 1
FISSDK/FISSDKDemo/ViewModels/MainWindowViewModel.cs

@@ -713,7 +713,7 @@ namespace FISSDKDemo.ViewModels
             {
                 Directory.CreateDirectory(fisLogPath);
             }
-            _ultrasoundMachineInfo = new UltrasoundMachineInfo("SerialNumber01", "DongleId01", true, string.Empty, "VINNO10", "1.11.0", "2.2.27.5", cpuName, (int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight, fisFolder, fisLogPath);
+            _ultrasoundMachineInfo = new UltrasoundMachineInfo("", "DongleId01", true, string.Empty, "VINNO10", "1.11.0", "2.2.27.5", cpuName, (int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight, fisFolder, fisLogPath);
             _fisAfterSalesTasks = new List<IFISAfterSalesTask>
             {
                 new ExecutePrinterSettingTask(),

+ 1 - 1
FISSDK/FISSDKDemoV2/Manager/FISManager.cs

@@ -100,7 +100,7 @@ namespace FISSDKDemoV2.Manager
             }
             var screenWidth = FISSDKDemoSettings.Instance.Width == 0 ? 1280 : FISSDKDemoSettings.Instance.Width;
             var screenHeight = FISSDKDemoSettings.Instance.Height == 0 ? 720 : FISSDKDemoSettings.Instance.Height;
-            UltrasoundMachineInfo = new UltrasoundMachineInfo(cpuId, "", true, string.Empty, "USDemoV2", "2.11.0", "2.2.27.5", cpuName, screenWidth, screenHeight, fisFolder, fisLogPath, FISLoginSourceV2.PC, FISPlatform.Windows, "US");
+            UltrasoundMachineInfo = new UltrasoundMachineInfo(string.Empty, "", true, string.Empty, "USDemoV2", "2.11.0", "2.2.27.5", cpuName, screenWidth, screenHeight, fisFolder, fisLogPath, FISLoginSourceV2.PC, FISPlatform.Windows, "US");
             var fisAfterSalesTaskLibs = new List<IFISAfterSalesTask>
             {
                 new ExecutePrinterSettingTask(),

+ 4 - 21
Vinno.FIS.Sonopost/Managers/KeyBoardListenManager.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Diagnostics;
 using System.Runtime.InteropServices;
 using System.Windows.Input;
 using Vinno.FIS.Sonopost.Common;
@@ -25,22 +24,15 @@ namespace Vinno.FIS.Sonopost.Managers
         // 键盘处理委托实例
         private LowLevelKeyboardProc _keyboardProc;
 
-        // 导入SetWindowsHookEx函数
-        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
 
-        // 导入UnhookWindowsHookEx函数
-        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
-        [return: MarshalAs(UnmanagedType.Bool)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern bool UnhookWindowsHookEx(IntPtr hhk);
 
-        // 导入CallNextHookEx函数
-        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam);
 
-        [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
-        private static extern IntPtr GetModuleHandle(string lpModuleName);
-
         // 声明KeyboardProc委托类型
         private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
 
@@ -55,7 +47,7 @@ namespace Vinno.FIS.Sonopost.Managers
         public KeyBoardListenManager()
         {
             _keyboardProc = KeyboardHookCallback;
-            _keyboardHookID = SetKeyboardHook(_keyboardProc);
+            _keyboardHookID = SetWindowsHookEx(WH_KEYBOARD_LL, _keyboardProc, IntPtr.Zero, 0);
         }
 
         public void StartKeyBoardListen()
@@ -78,15 +70,6 @@ namespace Vinno.FIS.Sonopost.Managers
             }
         }
 
-        private IntPtr SetKeyboardHook(LowLevelKeyboardProc proc)
-        {
-            using (Process curProcess = Process.GetCurrentProcess())
-            using (ProcessModule curModule = curProcess.MainModule)
-            {
-                return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
-            }
-        }
-
         public void StopKeyBoardListen()
         {
             if (!_isStarted)

+ 1 - 1
Vinno.FIS.Sonopost/Managers/LiveVideoManager.cs

@@ -427,7 +427,7 @@ namespace Vinno.FIS.Sonopost.Managers
             }
             catch (Exception ex)
             {
-                Logger.WriteLineError($"LiveVideoManager Start Preview Error:{ex}");
+                Logger.WriteLineError($"LiveVideoManager ChangeRealTimeCaptureSetting Error:{ex}");
             }
         }
 

+ 1 - 1
Vinno.FIS.TRTCClient.Common/Pipe/PipeClient.cs

@@ -10,9 +10,9 @@ namespace Vinno.FIS.TRTCClient.Common.Pipe
     {
         private readonly NamedPipeClientStream _pipeClient;
         private readonly object _lock = new object();
+        private readonly CancellationTokenSource _cts;
 
         private Task _task;
-        private CancellationTokenSource _cts;
         private int _retryCount;
         private bool _disposed;
 

+ 2 - 2
Vinno.FIS.TRTCClient.Common/Pipe/PipeServer.cs

@@ -9,12 +9,12 @@ namespace Vinno.FIS.TRTCClient.Common.Pipe
     public class PipeServer : IDisposable
     {
         private readonly NamedPipeServerStream _pipeServer;
+        private readonly CancellationTokenSource _cts;
+        private readonly byte[] _currentLengthArray;
 
-        private CancellationTokenSource _cts;
         private Task _task;
         private bool _disposed;
         private byte[] _currentByteArray;
-        private byte[] _currentLengthArray;
 
         /// <summary>
         /// Gets the pipe name.

BIN
packages/WingInterfaceLibrary.dll