private void RenderForm(Form frm) { if (frm == null) { return; } frm.Size = new Size(this.pBody.Size.Width, this.pBody.Height); SetParent(frm.Handle, this.pBody.Handle); frm.Show(); IHartCommunication iHart = _ActiveForm as IHartCommunication; if (iHart != null) { iHart.HartDevice = HartDevice; iHart.ReadData(); } }
private void ShowDeviceState() { HartSDK.UniqueIdentifier did = null; if (HartDevice != null && HartDevice.IsConnected) { did = HartDevice.ReadUniqueID(); } txtDeviceID.IntergerValue = did != null ? did.DeviceID : 0; btnWritePollingAddress.Enabled = HartDevice != null && HartDevice.IsConnected; btnWritePollingAddress.Enabled = HartDevice != null && HartDevice.IsConnected; foreach (Control ctrl in pCommand.Controls) { if (ctrl is Button) { ctrl.Enabled = HartDevice != null && HartDevice.IsConnected; } } if (_ActiveForm != null) { IHartCommunication iHart = _ActiveForm as IHartCommunication; iHart.HartDevice = HartDevice; iHart.ReadData(); } }
public HartCommunicationService(IHartCommunication communication) { _communication = communication; }