Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
 protected override void OnResume()
 {
     if (!httpConnection.Connect())
     {
         MainPage = new NoInternetPage();    // Http Connection was unsuccessful
         return;
     }
     MainPage = new HomePage();  // Http Connection successful, proceed to homepage
 }
Exemplo n.º 3
0
 protected override void OnStart()
 {
     httpConnection = new SimpliPassHttpConnection();
     if (!httpConnection.Connect())
     {
         MainPage = new NoInternetPage();    // Http Connection was unsuccessful
         return;
     }
     MainPage = new HomePage
     {
         BindingContext = new HomePageViewModel(httpConnection)
     };  // Http Connection successful, proceed to homepage
 }
Exemplo n.º 4
0
        public App()
        {
            AndroidSpecific.Application.SetWindowSoftInputModeAdjust(this, AndroidSpecific.WindowSoftInputModeAdjust.Resize);

            InitializeComponent();
            CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
            {
                if (args.IsConnected)
                {
                    MainPage = new MainPage();
                }
                else
                {
                    MainPage = new NoInternetPage();
                }
            };
            MainPage = new MainPage();
        }