private async Task <KioskDto> UpdateKioskAsync(KioskDto kiosk, int groupId, int countryId)
        {
            _log.Debug("Begin ProcessKioskAsync Update");
            var defaultValue = await _collectDeviceService.CollectDeviceInfoAsync();

            _log.Debug("defaultValue: " + defaultValue);
            kiosk.Name         = SettingsConfigurationCommon.MACHINE_NAME;
            kiosk.GroupId      = groupId;
            kiosk.CountryId    = countryId;
            kiosk.IpAddress    = UnitHelper.GetLocalIPAddress();
            kiosk.DefaultValue = defaultValue;
            kiosk.Status       = KioskStatus.online;
            kiosk = await _apiService.UpdateKioskAsync(kiosk);

            return(kiosk);
        }
示例#2
0
        public virtual async Task <KioskDto> CreateKioskAsync(KioskDto kioskDto)
        {
            HttpResponseMessage response = await _proxyService.PostJsonAsync("/api/kiosks", new
            {
                machineId    = kioskDto.MachineId,
                name         = kioskDto.Name,
                countryId    = kioskDto.CountryId,
                countryName  = kioskDto.CountryName,
                address      = kioskDto.Address,
                groupId      = kioskDto.GroupId,
                groupName    = kioskDto.GroupName,
                ipAddress    = kioskDto.IpAddress,
                defaultValue = kioskDto.DefaultValue,
                status       = kioskDto.Status,
                @Lat         = kioskDto.Lat,
                @long        = kioskDto.Long,
            });

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <KioskDto>());
        }
        public virtual void Start()
        {
            _log.Debug("Begin Start");

            _log.Debug("ProcessKioskAsync");

            _kioskDto = AsyncHelper.RunSync(() => ProcessKioskAsync());

            _log.Debug("GetClientByClientId");

            _clientDto = AsyncHelper.RunSync(() => _apiService.GetClientByClientId(KioskConfigurationHepler.GetValueFromSecurity(CLIENT_ID)));

            _log.Debug("Begin connect signalR server");

            _signalR.OnSuccess        += OnSuccess;
            _signalR.OnReconnect      += OnReconnect;
            _signalR.OnConnectionSlow += OnConnectionSlow;
            _signalR.OnReconnecting   += OnReconnecting;
            _signalR.OnBeforeStop     += OnBeforeStop;

            _signalR.Run(new ObjectState(_kioskDto, _clientDto));

            _log.Debug("End Start");
        }
示例#4
0
 public ObjectState(KioskDto kioskDto, ClientDto clientDto)
 {
     KioskDto  = kioskDto;
     ClientDto = clientDto;
 }