public override void ViewWillAppear(bool animated) { //if (this.ViewControllers[2].GetType() != typeof(RewardCollectionViewController)) //{ // UIViewController parentController = Platform.RootViewController; // if (parentController?.GetType() == typeof(SLNavigationController)) // { // var child = parentController.ChildViewControllers[0]; // (child as MainViewController).SwapInViewController("Rewards", "RewardCollectionViewController", ENavigationTabs.REWARDS); // } //} var viewModel = this.ViewModel; SetupTapBar(); var current = Xamarin.Essentials.Connectivity.NetworkAccess; if (current != NetworkAccess.Internet) { var messageView = ConnectionMessageView.Create(); messageView.Frame = new CGRect(0, this.TabBar.Frame.Y - ConnectionMessageView.CollectionViewHeight, messageView.Frame.Width, ConnectionMessageView.CollectionViewHeight); _connectionMessageView = messageView; this.View.AddSubview(_connectionMessageView); } Xamarin.Essentials.Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged; base.ViewWillAppear(animated); }
private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e) { var current = e.NetworkAccess; if (current == NetworkAccess.Internet) { // Connection to internet is available _connectionMessageView?.RemoveFromSuperview(); return; } if (_connectionMessageView == null) { var messageView = ConnectionMessageView.Create(); messageView.Frame = new CGRect(0, this.TabBar.Frame.Y - messageView.Frame.Height, messageView.Frame.Width, messageView.Frame.Height); _connectionMessageView = messageView; _connectionMessageView.ClipsToBounds = true; this.View.AddSubview(_connectionMessageView); return; } this.View.AddSubview(_connectionMessageView); }