void setNetworkStatus() { if (CrossConnectivity.Current != null && CrossConnectivity.Current.IsConnected) { MainPage = new NetworkViewPage(); } else { MainPage = new NoNetworkPage(); } }
void CrossConnectivity_Current_ConnectivityChanged(object sender, Connectivity.Plugin.Abstractions.ConnectivityChangedEventArgs e) { if (e.IsConnected) { MainPage = new NetworkViewPage(); } else { MainPage = new NoNetworkPage(); } }
public App() { InitializeComponent(); if (CrossConnectivity.Current.IsConnected) { MainPage = new NetworkViewPage(); } else { MainPage = new NoNetworkPage(); } }
private void Current_ConnectivityChanged(object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e) { Type currentPage = MainPage.GetType(); if (e.IsConnected && currentPage != typeof(NetworkViewPage)) { MainPage = new NetworkViewPage(); } else if (!e.IsConnected && currentPage != typeof(NoNetworkPage)) { MainPage = new NoNetworkPage(); } }
protected override void OnStart() { // Handle when your app starts CrossConnectivity.Current.ConnectivityChanged += (s, e) => { if (e.IsConnected) { this.MainPage = new NetworkViewPage(); } else { MainPage = new NoNetworkPage(); } }; }
protected void OnConnectivityChanged(object sender, ConnectivityChangedEventArgs e) { var currentType = MainPage.GetType(); if (CrossConnectivity.Current.IsConnected) { if (currentType != typeof(NetworkViewPage)) { MainPage = new NetworkViewPage(); } } else { if (currentType != typeof(NoNetworkPage)) { MainPage = new NoNetworkPage(); } } }
public App() { noNetworkPage = new NoNetworkPage(); networkViewPage = new NetworkViewPage(); }