Пример #1
0
        private async Task <bool> CheckUserExistance()
        {
            _logger.LogInformation("Checking connection to server");
            try
            {
                if (await _sender.CheckUser(UserKey) < 0)
                {
                    await _sender.AddUser(UserKey, _sensor.GetSensors());

                    _logger.LogInformation("User created, starting...");
                }
                else
                {
                    _logger.LogInformation("User exists, starting...");
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message + "\n" + e.StackTrace);
                return(false);
            }
            return(true);
        }