public void AquireFocus() { try { ReleaseFocus(); Debug("Aquiring focus..."); WinBioErrorCode result = WinBio.AcquireFocus(); Debug(result.ToString()); if (result == WinBioErrorCode.Ok) { UpdateStatus(Statuses.Listening); } else { throw new Exception("Non-OK response trying to aquire focus."); } } catch (Exception e) { Debug("Error aquiring focus"); Debug(e.Message); UpdateStatus(Statuses.NoFocus); } }
public static void ThrowOnError(WinBioErrorCode errorCode) { if (errorCode == WinBioErrorCode.Ok) { return; } throw new WinBioException(errorCode); }
public bool ReleaseFocus() { Debug("Releasing focus..."); try { WinBioErrorCode result = WinBio.ReleaseFocus(); Debug(result.ToString()); if (result == WinBioErrorCode.Ok) { UpdateStatus(Statuses.NoFocus); } return(result == WinBioErrorCode.Ok); } catch (Exception) { return(false); } }
public static void ThrowOnError(WinBioErrorCode errorCode) { if (errorCode == WinBioErrorCode.Ok) return; throw new WinBioException(errorCode); }
public WinBioException(WinBioErrorCode errorCode, string message) : base(string.Format("{0}: {1}", message, errorCode)) { HResult = (int) errorCode; ErrorCode = errorCode; }
public WinBioException(WinBioErrorCode errorCode) : base(errorCode.ToString()) { ErrorCode = errorCode; }
public WinBioException(WinBioErrorCode errorCode, string message) : base(string.Format("{0}: {1}", message, errorCode)) { HResult = (int)errorCode; ErrorCode = errorCode; }