private async void Item_OnChange(object sender, ElementEventArgs e)
        {
            var checkbox     = (AppCheckBox)sender;
            var selectedItem = ((SelectListItemViewModel)checkbox.BindingContext);

            if (checkbox.IsChecked == selectedItem.DefaultIsSelected && !selectedItem.CustomerTap)
            {
                return;
            }

            if (ViewModel.SelectListPage == SelectListPageEnum.Languages)
            {
                App.CurrentCostumerSettings.LanguageId = selectedItem.Id;
                await _customerService.CreateOrUpdateCustomerSettings(true, true);

                App.LocaleResources = new List <LocaleResourceModel>();
                _localizationService.CreateOrUpdateLocales(true);
                App.SetMainPage();
            }

            if (ViewModel.SelectListPage == SelectListPageEnum.Currencies)
            {
                App.CurrentCostumerSettings.CurrencyId = selectedItem.Id;
                await _customerService.CreateOrUpdateCustomerSettings(true, true);

                await Navigation.PopAsync();
            }
        }
Beispiel #2
0
        public App()
        {
            InitializeComponent();

            //check if device is connected to internet
            //https://docs.microsoft.com/en-us/xamarin/essentials/connectivity?context=xamarin%2Fxamarin-forms&tabs=ios
            var current = Connectivity.NetworkAccess;

            if (current != NetworkAccess.Internet)
            {
                MainPage = new NoInternetPage();
                return;
            }

            if (_localizationService == null)
            {
                _localizationService = LocatorViewModel.Resolve <ILocalizationService>();
            }

            if (_customerService == null)
            {
                _customerService = LocatorViewModel.Resolve <ICustomerService>();
            }

            CurrentCostumerSettings = new CustomerSettingModel();

            _customerService.SetCurrentCustomer(true, true);
            _localizationService.CreateOrUpdateLocales();

            InitApp();
        }