From ba90e5f46e8aa0c9b385d4ae0bbae0cd44173e8d Mon Sep 17 00:00:00 2001 From: achi Date: Fri, 28 Feb 2020 11:11:34 +1000 Subject: [PATCH] =?UTF-8?q?fix(Plugins):=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B8?= =?UTF-8?q?=D0=BB=D1=8F=D1=86=D0=B8=D1=8F=20=D0=B2=20=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D1=81=D0=B8=D0=B8=203.34?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/Resources.Designer.cs | 2 +- VKT5_RemoteConsole/Vkt5Console.cs | 20 ++++++------------- VKT5_RemoteConsole/Vkt5_RemoteConsole.csproj | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/VKT5_RemoteConsole/Properties/Resources.Designer.cs b/VKT5_RemoteConsole/Properties/Resources.Designer.cs index 7f3ade7..a111edd 100644 --- a/VKT5_RemoteConsole/Properties/Resources.Designer.cs +++ b/VKT5_RemoteConsole/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Vkt5_RemoteConsole.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/VKT5_RemoteConsole/Vkt5Console.cs b/VKT5_RemoteConsole/Vkt5Console.cs index 3f1e71b..4e54b39 100644 --- a/VKT5_RemoteConsole/Vkt5Console.cs +++ b/VKT5_RemoteConsole/Vkt5Console.cs @@ -154,35 +154,27 @@ namespace Vkt5_RemoteConsole /// /// /// - private void SendRequest(byte[] request, int responseLength, VktDataReadEventHandler readHandler) + private async void SendRequest(byte[] request, int responseLength, VktDataReadEventHandler readHandler) { - CommandSettings cmd = new CommandSettings("", 1000, responseLength, 10); + var cmd = new CommandSettings("", 1000, responseLength, 10); this.handlers.AddLast(readHandler); this.responseLength = responseLength; - this.remoteConsole.SendCommandAsync(request, cmd, 0, DataReadCallback, null); - } - - private void DataReadCallback(Lers.AsyncOperation asyncOp) - { try { - // Завершаем операцию чтения данных - Lers.Networking.ExecuteRequestAsyncOperation execRequestAsyncOp - = (Lers.Networking.ExecuteRequestAsyncOperation)asyncOp; - - execRequestAsyncOp.EndExecuteRequest(); + await remoteConsole.SendCommandAsync(request, cmd, 0); } catch (Exception e) { // При ошибке отправки данных отключаемся от устройства LogError("Ошибка чтения данных. " + e.Message); } + } - private void remoteConsole_DeviceDataReceived(object sender, DeviceDataEventArgs args) + private async void remoteConsole_DeviceDataReceived(object sender, DeviceDataEventArgs args) { // Проверим, что консоль подключена к прибору if (!this.remoteConsole.IsConnected) @@ -205,7 +197,7 @@ namespace Vkt5_RemoteConsole // Отключаемся try { - this.remoteConsole.DisconnectAsync(null, null); + await remoteConsole.DisconnectAsync(); } catch (Lers.PermissionDeniedException exc) { diff --git a/VKT5_RemoteConsole/Vkt5_RemoteConsole.csproj b/VKT5_RemoteConsole/Vkt5_RemoteConsole.csproj index eb4fcc7..5feafe7 100644 --- a/VKT5_RemoteConsole/Vkt5_RemoteConsole.csproj +++ b/VKT5_RemoteConsole/Vkt5_RemoteConsole.csproj @@ -10,7 +10,7 @@ Properties Vkt5_RemoteConsole Vkt5_RemoteConsole - v4.6 + v4.8 512