Beispiel #1
0
 private async void Current_ConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     if (e.IsConnected)
     {
         await PremindClient.StartClient();
     }
 }
Beispiel #2
0
 public void ConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     if (OnConnectivityTypeChanged != null)
     {
         OnConnectivityTypeChanged(sender, e);
     }
 }
 private void ConnectivityServiceConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     Execute.BeginOnUIThread(() =>
     {
         RaisePropertyChanged(nameof(ConnectionTypes));
     });
 }
Beispiel #4
0
        private void UpdateText(ConnectivityTypeChangedEventArgs e)
        {
            var connected = e.IsConnected ? "Connected" : "Not connected";
            var type      = string.Join(", ", e.ConnectionTypes);

            labelConnectivity.Text = $"{connected}: {type}";
        }
Beispiel #5
0
        void OnConnectivityChanged(object sender, ConnectivityTypeChangedEventArgs e)
        {
            IsConnected = e.IsConnected;

            if (!IsConnected)
            {
                var items = RunningTasks.ToList();
                foreach (var item in items)
                {
                    item.Value.Cancel();
                    RunningTasks.Remove(item.Key);
                }
            }
        }
 public static void CurrentOnConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs connectivityTypeChangedEventArgs)
 {
     try
     {
         if (!connectivityTypeChangedEventArgs.IsConnected)
         {
             NoNetwork();
             return;
         }
         else
         {
             ConnectionRestored();
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #7
0
        private void OnConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs connectivityTypeChangedEventArgs)
        {
            try
            {
                var connectionDetails = "网络连接失败,请重新尝试!";

                if (connectivityTypeChangedEventArgs.IsConnected)
                {
                    connectionDetails = string.Format("网络{0}已经连接!", CrossConnectivity.Current.ConnectionTypes.FirstOrDefault());
                }

                _dialogService.ShortAlert(connectionDetails);
            }
            catch (Exception ex)
            {
                _dialogService.LongAlert(ex.Message);
            }
        }
Beispiel #8
0
        protected void HandleConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
        {
            var types = e.ConnectionTypes.ToArray();

            bool IsNetworkStatusChanged(IList <ConnectionType> connectionTypes)
            {
                return(ConnectionTypes.Except(connectionTypes).Any() ||
                       connectionTypes.Except(ConnectionTypes).Any());
            }

            if (!IsNetworkStatusChanged(types))
            {
                return;
            }

            ConnectionTypes = types;

            InvokeNetworkSourceChangedEvent();
        }
Beispiel #9
0
 private void OnConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     if (e.IsConnected.ToString().Equals("False"))
     {
         if (CrossConnectivity.Current.ConnectionTypes.Contains(ConnectionType.WiFi))
         {
             // WE LOST AN CONNECTION BUT WIFI IS STILL ON
             connectionDetailsLbl.Text = "WE LOST AN CONNECTION BUT WIFI IS STILL ON";
         }
     }
     else
     {
         if (CrossConnectivity.Current.ConnectionTypes.Contains(ConnectionType.WiFi))
         {
             // WIFI WAS TURN ON AND WE HAVE A CONNECTION
             connectionDetailsLbl.Text = "WIFI WAS TURN ON AND WE HAVE A CONNECTION";
         }
         else
         {
             // WE HAVE A CONNECTION BUT NOT WIFI
             connectionDetailsLbl.Text = "WE HAVE A CONNECTION BUT NOT WIFI";
         }
     }
 }
Beispiel #10
0
 private void CurrentConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     ConnectivityTypeChanged?.Invoke(sender, e);
 }
Beispiel #11
0
 private static void Current_ConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     ConnectionTypeChanged?.Invoke(sender, null);
 }
Beispiel #12
0
 private void HandleConnectivityChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     ConnectionDetails.Text = CrossConnectivity.Current.ConnectionTypes.First().ToString();
 }
 private void OnConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs connectivityTypeChangedEventArgs)
 {
     SetConnectionDetails();
 }
Beispiel #14
0
 void _connectivityService_ConnectivityTypeChanged(object sender, ConnectivityTypeChangedEventArgs e)
 {
     Debug.WriteLine($"**** {this.GetType().Name}.{nameof(_connectivityService_ConnectivityTypeChanged)}");
     NetworkDescription = GetNetworkDescription();
 }
 void OnConnectivityTypeChange(object sender, ConnectivityTypeChangedEventArgs e) => ConnectivityTypeChanged?.Invoke(sender, e);