Ejemplo n.º 1
0
        public async Task UpdateUserTaxiHailNetworkSettings(UserTaxiHailNetworkSettings userTaxiHailNetworkSettings)
        {
            // Update cached user settings
            UserCache.Set(UserTaxiHailNetworkSettingsCacheKey, userTaxiHailNetworkSettings);

            var request = new UserTaxiHailNetworkSettingsRequest
            {
                AccountId = CurrentAccount.Id,
                UserTaxiHailNetworkSettings = userTaxiHailNetworkSettings
            };

            await UseServiceClientAsync <IAccountServiceClient>(client => client.UpdateUserTaxiHailNetworkSettings(request));
        }
        private void UpdateUserTaxiHailNetworkSettings()
        {
            var disabledFleets = UserTaxiHailNetworkSettings.Where(s => !s.Value)
                                 .Select(s => s.Name)
                                 .ToArray();

            var updatedUserTaxiHailNetworkSettings = new UserTaxiHailNetworkSettings
            {
                IsEnabled      = IsTaxiHailNetworkEnabled,
                DisabledFleets = disabledFleets
            };

            _accountService.UpdateUserTaxiHailNetworkSettings(updatedUserTaxiHailNetworkSettings);
        }
        private async void LoadUserTaxiHailNetworkSettings()
        {
            using (this.Services().Message.ShowProgress())
            {
                UserTaxiHailNetworkSettings.Clear();

                var networkFleets = await _networkRoamingService.GetNetworkFleets();

                var settings = await _accountService.GetUserTaxiHailNetworkSettings();

                IsTaxiHailNetworkEnabled = settings.IsEnabled;

                foreach (var networkFleet in networkFleets)
                {
                    UserTaxiHailNetworkSettings.Add(new ToggleItem
                    {
                        Display = networkFleet.CompanyName,
                        Name    = networkFleet.CompanyKey,
                        Value   = !settings.DisabledFleets.Contains(networkFleet.CompanyKey)
                    });
                }
            }
        }