private void OnStateChanged(AsyncData data) { using (data) { ResultCode resultCode; if (!data.TryGetResultCode(out resultCode) || resultCode != ResultCode.Ok) { return; } using (var stateBag = data.GetDataAs <StateBag>()) { if (stateBag != null) { if (_isInitialized) { T value; if (GetData(stateBag, out value)) { _currentValue = new EyeXEngineStateValue <T>(value); } } } } } }
private static void OnSnapshotCommitted(AsyncData asyncData) { try { ResultCode resultCode; if (!asyncData.TryGetResultCode(out resultCode)) { return; } if (resultCode == ResultCode.InvalidSnapshot) { print("Snapshot validation failed: " + GetErrorMessage(asyncData)); } else if (resultCode != ResultCode.Ok && resultCode != ResultCode.Cancelled) { print("Could not commit snapshot: " + GetErrorMessage(asyncData)); } } catch (InteractionApiException ex) { print("EyeTracking operation failed: " + ex.Message); } asyncData.Dispose(); }
/// <summary> /// Callback method useful during application development to find malformed or /// incorrectly set up snapshots and interactors. /// </summary> /// <param name="asyncData">Data packet that contains value code and error messages.</param> private static void OnSnapshotCommitted(AsyncData asyncData) { using (asyncData) { ResultCode resultCode; Debug.Assert(asyncData.TryGetResultCode(out resultCode), "Failed to read value code after committing snapshot."); Debug.Assert(resultCode != ResultCode.InvalidSnapshot, "Snapshot validation failed: " + GetErrorMessage(asyncData)); } }
private void OnStateChanged(AsyncData data) { using (data) { ResultCode resultCode; if (!data.TryGetResultCode(out resultCode) || resultCode != ResultCode.Ok) { return; } using (var stateBag = data.GetDataAs <StateBag>()) { T value; if (stateBag.TryGetStateValue(out value, _statePath)) { SetCurrentValue(new EngineStateValue <T>(value)); } } } }
/// <summary> /// Callback method useful during application development to find malformed or /// incorrectly set up snapshots and interactors. /// </summary> /// <param name="asyncData">Data packet that contains value code and error messages.</param> private static void OnSnapshotCommitted(AsyncData asyncData) { using (asyncData) { ResultCode resultCode; Debug.Assert(asyncData.TryGetResultCode(out resultCode), "Failed to read value code after committing snapshot."); Debug.Assert(resultCode != ResultCode.InvalidSnapshot, "Snapshot validation failed: " + GetErrorMessage(asyncData)); } }
private void OnSnapshotCommitted(AsyncData asyncData) { ResultCode resultCode; if (!asyncData.TryGetResultCode(out resultCode)) return; if (resultCode == ResultCode.InvalidSnapshot) { Debug.LogWarning("Snapshot validation failed: " + GetErrorMessage(asyncData)); } else if (resultCode != ResultCode.Ok) { Debug.LogWarning("Could not commit snapshot: " + GetErrorMessage(asyncData)); } }