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 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 WinBioException(WinBioErrorCode errorCode) : base(errorCode.ToString()) { ErrorCode = errorCode; }