/// <summary> /// Асинхронная отправка команды /// </summary> /// <param name="commandValueWriter"></param> /// <returns></returns> public async Task WriteDataAsync(string commandValueWriter) { if (IsControlCommadVisible) { UserControlCommandTarget.SetButtonSendEnabled(false); UserControlCommandTarget.UpdateError(""); } try { await myPipeClientServer.SendAsync(commandValueWriter, 1000); } catch (Exception ex) { Debug.WriteLine("ERROR: {0}", ex.ToString()); //Await Task.Run(Function() Console.WriteLine("ERROR: {0}", ex.ToString)) if (IsControlCommadVisible) { UserControlCommandTarget.UpdateError(ex.ToString()); } ErrorCommand = ex.ToString(); WriteCompleted?.Invoke(this, new WriteCompletedEventArgs(ex, false, this)); } if (IsControlCommadVisible) { UserControlCommandTarget.UpdateSendTextBox(commandValueWriter); UserControlCommandTarget.SetButtonSendEnabled(true); } }
private void ListCommandsSend_Added(object sender, AlarmChangeCommandEventArgs e) { if (IsControlCommadVisible) { UserControlCommandTarget.RefreshListCommandsSend(); } }
/// <summary> /// 2 этап Close /// </summary> public void Close() { if (UserControlCommandTarget != null) { UserControlCommandTarget.Close(); UserControlCommandTarget = null; } isRunListen = false; myPipeClientServer.Close(); }