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