示例#1
0
        private static void CheckIfInternetOverTime()
        {
            INetworkConnection networkConnection = DependencyService.Get <INetworkConnection>();

            networkConnection.CheckNetworkConnection();
            if (!networkConnection.IsConnected)
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (hasInternet)
                    {
                        if (!noInterShow)
                        {
                            hasInternet           = false;
                            labelScreen.IsVisible = true;
                            await ShowDisplayAlert();
                        }
                    }
                });
            }
            else
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    hasInternet           = true;
                    labelScreen.IsVisible = false;
                });
            }
        }
示例#2
0
        public static async Task <bool> CheckIfInternet()
        {
            INetworkConnection networkConnection = DependencyService.Get <INetworkConnection>();

            networkConnection.CheckNetworkConnection();

            return(networkConnection.IsConnected);
        }
示例#3
0
        public bool OnTimerTick()
        {
            networkConnection.CheckNetworkConnection();
            bool networkStatus = networkConnection.IsConnected;

            Debug.WriteLine("deteceted:" + networkStatus);

            if (networkStatus)
            {
                Navigation.PushModalAsync(new LoginPage());
                return(false);
            }
            return(true);
        }
示例#4
0
        public static async Task <bool> CheckIfInternetAlert()
        {
            INetworkConnection networkConnection = DependencyService.Get <INetworkConnection>();

            networkConnection.CheckNetworkConnection();

            if (!networkConnection.IsConnected)
            {
                if (!noInterShow)
                {
                    await ShowDisplayAlert();
                }

                return(false);
            }

            return(true);
        }