Exemple #1
0
        public static void AddError(string ParMessage, MethodBase Source, bool Display, bool ClearPreviousErrors)
        {
            if (ClearPreviousErrors)
            {
                ClearErrors();
            }

            BTError err = new BTError
            {
                ID        = LocalData.BTErrorsList.Count + 1,
                Message   = LocalData.uiTranslator.Translate(ParMessage),
                OccurDate = ToLocalDate(DateTime.Now),
            };


            if (!LocalData.ProductionOrDevelopmentMode)
            {
                err.Source = Source.DeclaringType.FullName;
            }


            LocalData.BTErrorsList.Add(err);

            if (Display)
            {
                DisplayErrors();
            }
        }
Exemple #2
0
        private void WatcherOnStopped(object sender, BTError btError)
        {
            string errorMsg = null;

            if (btError != null)
            {
                switch (btError.BluetoothErrorCode)
                {
                case BTError.BluetoothError.Success:
                    errorMsg = "WatchingSuccessfullyStopped";
                    break;

                case BTError.BluetoothError.RadioNotAvailable:
                    errorMsg = "ErrorNoRadioAvailable";
                    break;

                case BTError.BluetoothError.ResourceInUse:
                    errorMsg = "ErrorResourceInUse";
                    break;

                case BTError.BluetoothError.DeviceNotConnected:
                    errorMsg = "ErrorDeviceNotConnected";
                    break;

                case BTError.BluetoothError.DisabledByPolicy:
                    errorMsg = "ErrorDisabledByPolicy";
                    break;

                case BTError.BluetoothError.NotSupported:
                    errorMsg = "ErrorNotSupported";
                    break;

                case BTError.BluetoothError.OtherError:
                    errorMsg = "ErrorOtherError";
                    break;

                case BTError.BluetoothError.DisabledByUser:
                    errorMsg = "ErrorDisabledByUser";
                    break;

                case BTError.BluetoothError.ConsentRequired:
                    errorMsg = "ErrorConsentRequired";
                    break;

                case BTError.BluetoothError.TransportNotSupported:
                    errorMsg = "ErrorTransportNotSupported";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            if (errorMsg == null)
            {
                // All other errors - generic error message
                errorMsg = _restartingBeaconWatch
                    ? "FailedRestartingBluetoothWatch"
                    : "AbortedWatchingBeacons";
            }
            //SetStatusOutput(_resourceLoader.GetString(errorMsg));
            _errBleMessage = errorMsg;
        }
 void Provider_WatcherStopped(object sender, BTError error)
 {
     Debug.WriteLine("Beacon Service stopped with error: " + error.ToString());
 }