Пример #1
0
 private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.Internet)
     {
         LabelConnection.FadeTo(0).ContinueWith((result) => { });
     }
     else
     {
         LabelConnection.FadeTo(1).ContinueWith((result) => { });
     }
 }
Пример #2
0
 private async void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.None)
     {
         await LabelConnection.FadeTo(1).ContinueWith((result) => { });
     }
     else
     {
         await LabelConnection.FadeTo(0).ContinueWith((result) => { });
     }
 }
 private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.Internet)
     {
         LabelConnection.FadeTo(0).ContinueWith((result) => { });
         LabelStatus.Text = "Changed Net Access: " + Connectivity.NetworkAccess.ToString();
     }
     else
     {
         LabelConnection.FadeTo(1).ContinueWith((result) => { });
         LabelStatus.Text = "Changed Net Access: " + Connectivity.NetworkAccess.ToString();
     }
 }
Пример #4
0
        private async Task SetConnectivity()
        {
            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)
            {
                await LabelConnection.FadeTo(0).ContinueWith((result) => { });
            }
            else
            {
                await LabelConnection.FadeTo(1).ContinueWith((result) => { });
            }
        }
 private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.Internet)
     {
         LabelConnection.FadeTo(0).ContinueWith((result) => { });
         Infobox.Text            = "Changed Net Access: " + Connectivity.NetworkAccess.ToString();
         Infobox.BackgroundColor = Color.LightGreen;
     }
     else
     {
         LabelConnection.FadeTo(1).ContinueWith((result) => { });
         Infobox.Text            = "Changed Net Access: " + Connectivity.NetworkAccess.ToString();
         Infobox.BackgroundColor = Color.Red;
     }
 }
Пример #6
0
 private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
 {
     if (e.NetworkAccess == NetworkAccess.Internet)
     {
         LabelConnection.Text      = "Vous êtes en ligne";
         LabelConnection.TextColor = Color.Green;
         LabelConnection.FadeTo(1).ContinueWith((result) => { });
     }
     else
     {
         LabelConnection.Text      = "Vous êtes hors ligne";
         LabelConnection.TextColor = Color.Red;
         LabelConnection.FadeTo(1).ContinueWith((result) => { });
     }
 }
Пример #7
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            App.LocalDatabase.someEvent += LocalDatabase_someEvent;

            await Task.CompletedTask;


            MenuListView.ItemsSource = null;

            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
            var current = Connectivity.NetworkAccess;

            if (current != NetworkAccess.None)
            {
                await LabelConnection.FadeTo(0).ContinueWith((result) => { });

                var itemsOnline = await _menuItemDataStore.GetItemsAsync();

                if (itemsOnline != null)
                {
                    await App.LocalDatabase.DeleteAllMenuItemAsync();

                    await App.LocalDatabase.SaveMenuItemsAsync(itemsOnline);

                    MenuListView.ItemsSource = itemsOnline;
                }
            }

            if (MenuListView.ItemsSource == null)
            {
                var itemsOffline = App.LocalDatabase.LoadMenuItemsAsync();
                MenuListView.ItemsSource = await itemsOffline;
                await LabelConnection.FadeTo(1).ContinueWith((result) => { });
            }
        }