/// <summary> /// Initialize this component /// </summary> /// <returns></returns> protected override void OnInitialize() { base.OnInitialize(); try { if (portSettings == null) { portSettings = new RS232(1, 9600); } if (!string.IsNullOrEmpty(dsIPAddress.Val)) { portSettings.diCommPort.Val = System.Convert.ToInt32(dsIPAddress.Val); dsIPAddress.Val = string.Empty; } portSettings.ddReadWriteTimeOut.Val = System.Convert.ToInt32(U.ConvertFromInternal(Enums.UnitTypes.msec, ddReadTimeout.Val)); portSettings.Initialize(); string ret = string.Empty; SendCommand("STOP"); ret = WaitForCommand(); CheckOKReplied("STOP", ret); SendCommand("MANUAL"); ret = WaitForCommand(); CheckOKReplied("MANUAL", ret); SendCommand("EMGRST"); ret = WaitForCommand(); CheckOKReplied("EMGRST", ret); } catch (Exception ex) { portSettings.Destroy(); throw ex; } }