コード例 #1
0
        private async void StartUrlScanning()
        {
            IsBusy = true;
            try
            {
                var globalLatencyVerifierRequest = new GlobalLatenctyRequestModel(UrlForScanning.Value);
                var latencyResult = await _latencyRepository.GetLatency(globalLatencyVerifierRequest);

                NavigateToResultPage(latencyResult);
            }
            catch (GlobalLatencyFailedException ex)
            {
                _appLogger.Error(nameof(GlobalLatencyFailedException), ex);
                await _pageDialogService.DisplayAlertAsync("Error", "You probably reach your request limit for this URL or our service is unavalible", "OK");
            }
            catch (ServiceAuthenticationException ex)
            {
                _appLogger.Error(nameof(GlobalLatencyFailedException), ex);
                await _pageDialogService.DisplayAlertAsync("Error", "You don't have access to this feature", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #2
0
        public async Task <ActionResult <ApiContactResultModel> > Add([FromBody] ContactsModel model)
        {
            var result    = new ApiContactResultModel();
            var contactId = new IdValueObject().Value;

            try
            {
                model.Id = contactId;
                await _mediator.Send(new AddContactCommand(model));

                result.Success   = true;
                result.ContactId = contactId;
                return(Ok(result));
            }
            catch (InvalidEntityException ex)
            {
                result.Errors = new List <string> {
                    ex.Message
                };
                return(BadRequest(result));
            }
            catch (EntityValidationException ex)
            {
                result.Errors = ex.ValidationResults.Select(x => x.ErrorMessage);
                return(BadRequest(result));
            }
            catch (Exception ex)
            {
                result.Errors = new List <string> {
                    ex.Message
                };
                _logger.Error(ex, "Error adding contact");
                return(BadRequest(result));
            }
        }
コード例 #3
0
        public void StartWatch(string queueName)
        {
            if (Subscribe == null)
            {
                throw new ArgumentNullException(nameof(Subscribe));
            }

            while (true)
            {
                _logger.Debug($"NewQueueWatcherRabbitMQ: create connection");
                using (var connection = _factory.CreateConnection())
                {
                    try
                    {
                        MainLoop(queueName, connection);
                    }
                    catch (Exception ex)
                    {
                        var args = connection.CloseReason;
                        if (args != null)
                        {
                            _logger.Error($"NewQueueWatcherRabbitMQ: connection shutdown. Reason: {args.ReplyCode} - {args.ReplyText}");
                        }
                        else
                        {
                            _logger.Error($"NewQueueWatcherRabbitMQ: error: {ex.Message}");
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: WebClient.cs プロジェクト: heinrichI/bgTeam.Core
        private async Task <T> ProcessResultAsync <T>(HttpResponseMessage response)
            where T : class
        {
            CheckResult(response);

            if (response.Content.Headers.ContentType != null &&
                string.Equals(response.Content.Headers.ContentType.CharSet, "utf8", StringComparison.OrdinalIgnoreCase))
            {
                response.Content.Headers.ContentType.CharSet = "utf-8";
            }

            var result = await response.Content.ReadAsStringAsync();

            if (string.IsNullOrWhiteSpace(result))
            {
                return(default(T));
            }

            try
            {
                if (typeof(T) == typeof(string))
                {
                    return(result as T);
                }

                return(JsonConvert.DeserializeObject <T>(result));
            }
            catch (JsonSerializationException exp)
            {
                _logger.Error(result);
                _logger.Error(exp);

                throw new Exception($"Can't covert to {typeof(T)}. Response: {result}", exp);
            }
        }
コード例 #5
0
 public void Add(T entity)
 {
     using (var context = GetContext())
     {
         try
         {
             context.Set <T>().Add(entity);
             context.SaveChanges();
         }
         catch (Exception ex)
         {
             Logger.Error(ex, DateTime.UtcNow + ":" + ex.Message);
         }
     }
 }
コード例 #6
0
ファイル: Application'.cs プロジェクト: alvaro-jdart/CoreApp
        private IAppConfig Run()
        {
            #region Dependency

            TResultContainer resultContainer;

            try
            {
                foreach (var dependency in _dependencies)
                {
                    dependency.Value.Register(_container);
                }

                resultContainer = _verify(_container);
            }
            catch (Exception e)
            {
                _logger.Error(new Exception("Ошибка в регистрации зависимостей", e));
                throw e;
            }

            #endregion

            var resolver = new DependencyResolver <TResultContainer>(resultContainer, _getServiceFunc, _getAllServicesFunc);

            #region Init

            try
            {
                foreach (var init in _inits)
                {
                    init.Value.Init(resolver);
                }
            }
            catch (Exception e)
            {
                _logger.Error(new Exception("Ошибка в инициализации сервисов", e));
                throw e;
            }

            #endregion

            return(new AppConfig
            {
                DependencyResolver = resolver,
                Logger = _logger
            });
        }
コード例 #7
0
        public Task Run()
        {
            int counter = 0;

            while (counter < 20)
            {
                try
                {
                    counter++;
                    Thread.Sleep(200);
                    _appLogger.Info($"Hello world from Invoices Processor. Counter: {counter}");
                    Thread.Sleep(700);
                }
                catch (System.Exception)
                {
                    _appLogger.Error($"Error from Invoices Processor. Counter: {counter}");
                    if (counter == 20)
                    {
                        throw;
                    }
                }
            }

            throw new Exception("Error in InvoicesProcessor.");
        }
コード例 #8
0
        public async Task Execute(IJobExecutionContext context)
        {
            var correlationId = _correlationIdGenerator.Generate();

            try
            {
                JobNameGuard();

                _appLogger.Info($"{JobName} Job with correlationId {correlationId} is starting.");

                await ExecuteJob(context);

                _appLogger.Info($"{JobName} Job with correlationId {correlationId} is finished.");
            }
            catch (Exception exception)
            {
                var stringBuilder = new StringBuilder();
                stringBuilder.Append($"{JobName} with correlationId {correlationId} is failed.");
                stringBuilder.AppendLine();
                stringBuilder.Append($"Message:{exception.Message}");
                stringBuilder.AppendLine();
                stringBuilder.Append($"StackTrace:{exception.StackTrace}");
                stringBuilder.AppendLine();

                _appLogger.Error(stringBuilder.ToString());
            }
        }
コード例 #9
0
        public Task Run()
        {
            int counter = 0;

            while (counter < 20)
            {
                try
                {
                    counter++;
                    Thread.Sleep(400);
                    _appLogger.Info($"Hello world from Payments Processor. Counter: {counter}");
                    Thread.Sleep(300);
                }
                catch (System.Exception)
                {
                    _appLogger.Error($"Error from Payments Processor. Counter: {counter}");
                    if (counter == 20)
                    {
                        throw;
                    }
                }
            }

            return(Task.CompletedTask);
        }
コード例 #10
0
        public SendResponse Send(string message)
        {
            try
            {
                int price = _cost.CalculatePrice(message);
                _sender.Send(message);

                return(new SendResponse()
                {
                    Message = message,
                    Price = price,
                    ResultMessage = "Success"
                });
            }
            catch (Exception ex)
            {
                _logger.Error($"There was an error: {ex.Message}");

                return(new SendResponse()
                {
                    Message = string.Empty,
                    Price = 0,
                    ResultMessage = "Fail"
                });
            }
        }
コード例 #11
0
        public void InitializeServer(string address, int port, Action <string> callback)
        {
            _client = new UdpClient(address, port);
            if (_backgroundWorker == null)
            {
                _backgroundWorker = Task.Factory.StartNew(() =>
                {
                    while (true)
                    {
                        try
                        {
                            var data    = _client.Receive(ref _remoteIpEndPoint);
                            var message = Encoding.ASCII.GetString(data);
                            _logger.Debug(message);
                            callback(message);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error(ex.Message);
                        }

                        Thread.Sleep(10);
                    }
                });
            }
        }
コード例 #12
0
        public void Send(string message)
        {
            _logger.Info("Entering Retry Sender");
            // Non-Polly Hack - Polly was causing Lamar to choke
            const int retry = 3;

            try
            {
                for (int retryCount = 0; retryCount < retry; retryCount++)
                {
                    _logger.Info($"Attempt {retryCount} to send message");
                    try
                    {
                        _sender.Send(message);
                        break;                         // success
                    }
                    catch (Exception innException)
                    {
                        if (retry > retryCount + 1)
                        {
                            continue;                             // retry
                        }

                        throw innException;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error($"Error trying to send message: {ex.Message}");
            }
        }
コード例 #13
0
        public async Task <List <IPlexMovieMetadata> > GetMovieMetadataAsync(string libraryName)
        {
            try
            {
                var libraryId = await _repository.GetLibraryIdAsync(_client, libraryName);

                if (libraryId == null)
                {
                    _logger.Error($"Library '{libraryName}' not found!");
                    return(null);
                }

                return(await _repository.GetMovieLibraryMetadataAsync(_client, libraryId));
            }
            catch (ResponseFailureException ex)
            {
                _logger.ErrorException($"{ex.Message}\nRequest: {ex.RequestMethod}: {ex.RequestUri}", ex, ex.InnerException?.Message);
                return(null);
            }
            catch (UnexpectedHttpStatusCodeException ex)
            {
                var msg = $"Received '{ex.StatusCode}' ({(int)ex.StatusCode}) status code after {ex.ResponseDuration} ms from {ex.RequestMethod}: {ex.ResponseUri}";
                _logger.ErrorException($"{msg}\n{ex.Message}", ex);
                return(null);
            }
        }
コード例 #14
0
        private void UdpCallback(string payload)
        {
            try
            {
                var payloadObj = UdpPayload.Parse(payload);
                if (payloadObj.Status == PayloadStatus.Success)
                {
                    switch (payloadObj.Type)
                    {
                    case PayloadType.Controller:
                        HandleControllerPayload(payloadObj.Payload);
                        break;

                    case PayloadType.Mouse:
                        HandleMousePayload(payloadObj.Payload);
                        break;

                    default:
                        _logger.Warn($"Unknown payload type: {payloadObj.Type.ToString()}");
                        _logger.Debug($"Payload: {payload}");
                        break;
                    }
                }
                else
                {
                    _logger.Warn($"Unable to parse incoming payload");
                    _logger.Debug($"Payload: {payload}");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
コード例 #15
0
        private ITrigger CreateTrigger(string name, string group, string cronSchedule,
                                       RunJobScheduleOption runJobScheduleOption)
        {
            switch (runJobScheduleOption)
            {
            case RunJobScheduleOption.NotRun:
                return(TriggerBuilder.Create()
                       .WithIdentity(name, group)
                       .StartAt(DateTimeOffset.MaxValue)
                       .Build());

            case RunJobScheduleOption.CronExpression:
                return(TriggerBuilder.Create()
                       .WithIdentity(name, group)
                       .WithCronSchedule(cronSchedule)
                       .Build());

            case RunJobScheduleOption.RunNow:
                return(TriggerBuilder.Create()
                       .WithIdentity(name, group)
                       .StartNow()
                       .Build());

            default:
                _appLogger.Error(
                    $"RunJobScheduleOption : {runJobScheduleOption} not found for Trigger Name: {name}, Trigger Group {group}.");
                return(TriggerBuilder.Create()
                       .WithIdentity(name, group)
                       .StartAt(DateTimeOffset.MaxValue)
                       .Build());
            }
        }
コード例 #16
0
        private void SendQueue(IQueueMessage mess, string[] queues, string entityType = "entity empty", int?delay = 1, int tryAttempt = 1)
        {
            try
            {
                _queueProvider.PushMessage(mess, queues);

                _logger.Info($"Success send entity - {entityType}");
            }
            catch (Exception exp)
            {
                if (tryAttempt < 5)
                {
                    _logger.Warning($"Failed send entity {mess.Body} after {tryAttempt} attempt. We will try again. Exception - {exp.Message}");

                    Thread.Sleep(2000);

                    // повторить попытку отправления
                    SendQueue(mess, queues, entityType, delay, ++tryAttempt);
                }
                else
                {
                    _logger.Error($"Failed send entity {mess.Body} after {tryAttempt} attempt. Lost entity. Exception - {exp.Message}");
                }
            }
        }
コード例 #17
0
 public string Log([FromBody] AppError Error)
 {
     // Error.User = this.GetRefUser();
     _logger.Info(Error.FormatException());
     _logger.Error(Error.FormatException());
     _logger.Warn(Error.FormatException());
     return("Logged");
 }
コード例 #18
0
 public void Try()
 {
     _appLogger.Debug("DDDDDDDD" + " " + DateTime.Now);
     _appLogger.Error("EEEEEEEE" + " " + DateTime.Now);
     _appLogger.Info("IIIIIIIIII" + " " + DateTime.Now);
     _appLogger.Trace("TTTTTTTT" + " " + DateTime.Now);
     _appLogger.Fatal("FFFFFFFFF" + " " + DateTime.Now);
 }
コード例 #19
0
        private void ValidateExpenseClaimInput(ExpenseClaimInput input)
        {
            var result = _inputValidator.Validate(input);

            if (!result.IsValid)
            {
                _logger.Error($"ValidateExpenseClaimInput failed:\n{string.Join("\n", result.Errors)}");
                throw new ValidationException(result.Errors);
            }
        }
コード例 #20
0
        /// <inheritdoc />
        public void ManagerStart()
        {
            _logger.Info($"{nameof(ManagerStart)} was hit");

            // write runtime startup metrics
            var currentVersion = _fm.GetExecutingAssemblyVersion();
            var sb             = new StringBuilder();

            sb.AppendLine($"Starting up {nameof(AlertManager)} (version {currentVersion}) with the following settings:");
            sb.AppendLine($"\t{nameof(RuntimeSettings)} is {(_rs == null ? "null" : "initialized")}");
            sb.AppendLine($"\t- {nameof(_rs.IsLocalDebugging)} = {_rs.IsLocalDebugging}");
            sb.AppendLine($"\t- {nameof(_rs.EmailSmtpServer)} = {_rs.EmailSmtpServer}");
            sb.AppendLine($"\t- {nameof(_rs.EmailSmtpPort)} = {_rs.EmailSmtpPort}");
            sb.AppendLine($"\t- {nameof(_rs.EmailSmtpUseSsl)} = {_rs.EmailSmtpUseSsl}");
            sb.AppendLine($"\t- {nameof(_rs.EmailSenderAddress)} = {_rs.EmailSenderAddress}");
            sb.AppendLine($"\t- {nameof(_rs.EmailRecipientAddress)} = {_rs.EmailRecipientAddress}");
            _logger.Info(sb.ToString());

            // initialize uptime tracker
            _uptimeDelayInMinutes = _rs.IsLocalDebugging ? 1 : 20;
            _uptimeTimer          = new System.Threading.Timer(LogUptime);
            _uptimeTimer.Change(0, (int)TimeSpan.FromMinutes(_uptimeDelayInMinutes).TotalMilliseconds);

            // report battery presence
            _isBatteryDetected = IsBatteryAvailable();
            if (_isBatteryDetected)
            {
                _logger.Info("Battery was found");
            }
            else
            {
                _logger.Warn("No battery was found, so changes in power state will not be reported");
            }

            // report power draw
            _powerSource = SystemInformation.PowerStatus.PowerLineStatus;
            if (_powerSource == PowerLineStatus.Online)
            {
                _logger.Info($"{nameof(PowerLineStatus)} - Running on wall power");
            }
            else if (_powerSource == PowerLineStatus.Offline)
            {
                _logger.Warn($"{nameof(PowerLineStatus)} - Running on battery");
            }
            else
            {
                _logger.Error($"{nameof(PowerLineStatus)} - Unable to determine power draw source!");
            }

            // if on battery power mode, then drop into notification logic
            if (_powerSource == PowerLineStatus.Offline)
            {
                NotifyPowerOnBattery();
            }
        }
コード例 #21
0
        public void StartWatch(string queueName)
        {
            if (OnSubscribe == null)
            {
                throw new ArgumentNullException(nameof(OnSubscribe));
            }

            while (true)
            {
                _semaphore.Wait();
                Task.Factory.StartNew(async() =>
                {
                    _logger.Debug($"Start task - {Task.CurrentId}");

                    try
                    {
                        await DispatchRoutine(queueName);
                    }
                    catch (ProcessMessageException exp) when(exp.InnerException is BgTeamException bexp)
                    {
                        _logger.Warning($"Exception of type {bexp.GetType().Name}: {bexp.Message}{Environment.NewLine}{bexp.StackTrace}");

                        OnError?.Invoke(this, new ExtThreadExceptionEventArgs(exp.QueueMessage, bexp));
                    }
                    catch (ProcessMessageException exp)
                    {
                        _logger.Error(exp);
                        OnError?.Invoke(this, new ExtThreadExceptionEventArgs(exp.QueueMessage, exp));
                    }
                    catch (Exception exp)
                    {
                        _logger.Error(exp);
                    }
                    finally
                    {
                        _logger.Debug($"End task - {Task.CurrentId}");
                        ////await Task.Delay(2000);
                        _semaphore.Release();
                    }
                });
            }
        }
コード例 #22
0
 public virtual void Stop()
 {
     try
     {
         source?.Cancel();
     }
     catch (AggregateException e)
     {
         log.Error(e.Message, e);
     }
 }
コード例 #23
0
        private void TestInputFeeder()
        {
            var feeder = ServiceProvider.Get <IInputFeeder>();

            try
            {
                feeder.Connect("1");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }

            var report = new InputReport
            {
                ButtonReport = new ButtonReport(),
                AxisReport   = new InputAxisReport
                {
                    Axis1 = new Axis(),
                    Axis2 = new Axis()
                }
            };

            try
            {
                while (true)
                {
                    report.ButtonReport.Buttons = 4;
                    feeder.Feed(report);
                    System.Threading.Thread.Sleep(20);
                    report.ButtonReport.Buttons = 0;
                    feeder.Feed(report);
                    System.Threading.Thread.Sleep(20);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }
            Console.ReadKey();
        }
コード例 #24
0
        private ErrorModel BuildErrorModel(ExceptionContext exceptionContext)
        {
            var isShowErrors         = _configuration.GetValue <bool>("IsShowErrors");
            var genericErrorMessage  = _configuration.GetValue <string>("ErrorMessage");
            var isHttpContextNotNull = exceptionContext.HttpContext != null;
            var errorMessage         = genericErrorMessage;

            var exceptionType = exceptionContext.Exception.GetType();

            if (exceptionType == typeof(BusinessValidationException))
            {
                errorMessage = exceptionContext.Exception.Message;
                _logger.Warn(exceptionContext.Exception.Message);

                if (isHttpContextNotNull)
                {
                    exceptionContext.HttpContext.Response.StatusCode = 412;
                }
            }
            else if (exceptionType == typeof(BadRequestException))
            {
                errorMessage = exceptionContext.Exception.Message;
                _logger.Warn(exceptionContext.Exception.Message);

                if (isHttpContextNotNull)
                {
                    exceptionContext.HttpContext.Response.StatusCode = 400;
                }
            }
            else
            {
                _logger.Error(exceptionContext.Exception);

                if (isShowErrors)
                {
                    errorMessage = exceptionContext.Exception.Message;
                }

                if (isHttpContextNotNull)
                {
                    exceptionContext.HttpContext.Response.StatusCode = 500;
                }
            }

            var errorModel = new ErrorModel
            {
                Message = errorMessage,
                Id      = _correlationContextAccessor.CorrelationContext.CorrelationId
            };

            return(errorModel);
        }
コード例 #25
0
        public async Task <bool> RunAsync(IReadOnlyCollection <IPlexMovieMetadata> plexMovieMetadataItems)
        {
            var spinWheelService = _serviceFactory.CreateService <ISpinWheelService>();
            var embyService      = _serviceFactory.CreateService <IEmbyService>();

            var libraryIdentifier = await GetLibraryIdentifierAsync(embyService, spinWheelService, _consoleLibraryOptions.EmbyLibraryName);

            if (libraryIdentifier == null)
            {
                _logger.Error($"Cannot find Emby library '{_consoleLibraryOptions.EmbyLibraryName}'.");
                return(false);
            }

            var movieIdentifiers = await GetMovieIdentifiersAsync(embyService, spinWheelService, libraryIdentifier);

            if (movieIdentifiers == null || movieIdentifiers.Any() == false)
            {
                _logger.Error($"No movie files found in Emby library '{libraryIdentifier.Name}'.");
                return(false);
            }

            var embyFiles             = movieIdentifiers.Select(x => x.Filename).ToArray();
            var plexFiles             = plexMovieMetadataItems.SelectMany(x => x.Filenames).ToArray();
            var filesInBothServers    = embyFiles.Intersect(plexFiles).ToArray();
            var filesNotInBothServers = embyFiles.Except(plexFiles).Union(plexFiles.Except(embyFiles)).ToArray();

            await LogItemsAsync(Severity.Warn, "Following files do not exist in both servers:", filesNotInBothServers);

            // TODO - plexMovieMetadataItems could be null - handle this.
            var didUpdateMovies = await UpdateMoviesAsync(spinWheelService,
                                                          plexMovieMetadataItems.Where(x => x.Filenames.Any(y => filesInBothServers.Contains(y))).ToArray(),
                                                          movieIdentifiers.Where(x => filesInBothServers.Contains(x.Filename)).ToArray());

            // TODO - output some summary at the end?
            //var failedMovieTitles = updateResults.Where(x => x.IsUpdated == false).Select(x => x.Title).ToArray();
            //await LogItemsAsync(Severity.Warn, "Update failed for the following titles", failedMovieTitles);

            return(didUpdateMovies.All(x => x));
        }
コード例 #26
0
        public void Send(string message)
        {
            var retryPolicy =
                Policy.Handle <Exception>()
                .WaitAndRetry(3, (retryCount) =>
            {
                _logger.Info($"Attempt {retryCount} to send message");
                return(TimeSpan.FromSeconds(0));
            },
                              (exception, timespan) =>
            {
                _logger.Error($"Error trying to send message: {exception.Message}");
            });

            retryPolicy.Execute(() => _sender.Send(message));
        }
コード例 #27
0
 protected override Task <HttpResponseMessage> SendAsync(
     HttpRequestMessage request,
     CancellationToken cancellationToken)
 {
     appLogger.Debug(request);
     try
     {
         return(base.SendAsync(request, cancellationToken));
     }
     catch (Exception ex)
     {
         ex.Data["Request"] = request;
         appLogger.Error("SendAsync Error", ex);
         throw;
     }
 }
コード例 #28
0
        private static Task HandleExceptionAsync(HttpContext context, Exception exception, IAppLogger <ErrorHandlingMiddleware> logger)
        {
            var code = HttpStatusCode.InternalServerError;

            if (exception is EntityNotFoundException)
            {
                code = HttpStatusCode.NotFound;
            }
            else if (exception is EntityAlreadyExistsException)
            {
                code = HttpStatusCode.Conflict;
            }
            else if (exception is EntityValidationException)
            {
                code = HttpStatusCode.Conflict;
            }
            else if (exception is BadRequestException)
            {
                code = HttpStatusCode.BadRequest;
            }
            else if (exception is AuthenticationException)
            {
                code = HttpStatusCode.Unauthorized;
            }
            else if (exception is SecurityTokenExpiredException)
            {
                code = HttpStatusCode.Unauthorized;
            }
            else if (exception is AuthorizationException)
            {
                code = HttpStatusCode.Forbidden;
            }
            else if (exception is Exception)
            {
                logger.Error(exception, "Exception ");
            }



            var result = JsonConvert.SerializeObject(new { message = exception.Message });

            context.Response.ContentType = "application/json";
            context.Response.StatusCode  = (int)code;
            return(context.Response.WriteAsync(result));
        }
コード例 #29
0
        void Handle(Exception e, bool isCritical)
        {
            if (e == null)
            {
                return;
            }

            var formattedMessage = GetFormattedMessage(e, out var message, out var stackTrace);

            logger.Error($"{message}{Environment.NewLine}{stackTrace}");

            if (handlers.TryGetValue(e.GetType(), out var handler))
            {
                handler?.Invoke(e);
                return;
            }

            ShowMessage(isCritical ? "Critical error" : "Error", message);
        }
コード例 #30
0
ファイル: Feeder.cs プロジェクト: IronhideIvan/pass-thru
        private bool TryReconnect()
        {
            _logger.Info($"Reconnecting device '{_deviceId}'...");

            try
            {
                if (_joystick != null)
                {
                    Disconnect();
                }
                Connect(_deviceId.ToString());
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
            }

            return(_joystick.GetVJDStatus(_deviceId) == VjdStat.VJD_STAT_OWN);
        }