private void Execute(DeviceFunction function, bool doLogging = false) { if (device != null) { try { device.Execute(function); if (doLogging) { Log.Status(String.Format("Complete [{0}] ({1}ms)", function.ToString(), function.TransmissionTime)); if (function is DeviceIdentification identification) { if (!device.IsCompatible(identification)) { Log.Error("Incompatible device: {0} [{1}:{2}]", identification.Device, identification.ManufactureID, identification.DeviceID); } else { Log.Status("Compatible device: {0} [{1}:{2}]", identification.Device, identification.ManufactureID, identification.DeviceID); } } } propertyGrid.Refresh(); } catch (Exception e) { if (doLogging) { Log.Error("EXCEPTION:" + function.ToString() + " [" + e.Message + " ] "); } } } }