public static IDisposable Subscribe(this ISecsDevice device, SecsMessage filter, bool recoverable, Action <SecsMessage> callback) { var subscription = new SecsEventSubscription(device.ToolId, filter, recoverable, callback); device.Subscribe(subscription); return(subscription); }
async void GetLoadPortStatus(ISecsDevice device) { try { var s1f4 = await device.SendAsync(s1f3); #region Update UI for (int i = 0; i < 3; i++) { string state = null; switch (s1f4.SecsItem.Items[i].GetValue <byte>()) { case 0: state = "OutOfService"; break; case 1: state = "TransferBlock"; break; case 2: state = "ReadyToLoad"; break; case 3: state = "ReadyToUnload"; break; case 4: state = "LoadComplete"; break; default: state = "UnloadComplete"; break; } ports[i].State = state; } #endregion } catch { } }
async void GetLoadPortStatus(ISecsDevice device) { try { var s1f4 = await device.SendAsync(s1f3); #region Update UI for (int i = 0; i < 3; i++) { string state = null; switch (s1f4.SecsItem.Items[i].GetValue<byte>()) { case 0: state = "OutOfService"; break; case 1: state = "TransferBlock"; break; case 2: state = "ReadyToLoad"; break; case 3: state = "ReadyToUnload"; break; case 4: state = "LoadComplete"; break; default: state = "UnloadComplete"; break; } ports[i].State = state; } #endregion } catch { } }
public static IDisposable Subscribe(this ISecsDevice device, SecsMessage filter, Action <SecsMessage> callback) => device.Subscribe(filter, false, callback);