示例#1
0
        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);
 }
示例#3
0
        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);
            }
        }
示例#4
0
 public static void ThrowOnError(WinBioErrorCode errorCode)
 {
     if (errorCode == WinBioErrorCode.Ok) return;
     throw new WinBioException(errorCode);
 }
示例#5
0
 public WinBioException(WinBioErrorCode errorCode, string message)
     : base(string.Format("{0}: {1}", message, errorCode))
 {
     HResult = (int) errorCode;
     ErrorCode = errorCode;
 }
示例#6
0
 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;
 }
 public WinBioException(WinBioErrorCode errorCode)
     : base(errorCode.ToString())
 {
     ErrorCode = errorCode;
 }