示例#1
0
        private bool InternetStatus()
        {
            switch (Global.CheckInternetConnection())
            {
            case "None":
                if (MeteredNotification != null && MeteredNotification.GetHeight() > 0)
                {
                    MeteredNotification.DestroyNotification();
                }
                if (NoInternetConnection == null)
                {
                    NoInternetConnection = this.Notifications.CreateNotification("NoInternetNotification", "No internet connection", "Error", false);
                }
                if (NoInternetConnection != null && NoInternetConnection.GetHeight() == 0)
                {
                    NoInternetConnection.ShowNotification();
                }
                return(false);

            case "Metered":
                if (NoInternetConnection != null && NoInternetConnection.GetHeight() > 0)
                {
                    NoInternetConnection.DestroyNotification();
                }
                if (ConnectionDismiss == false)
                {
                    if (MeteredNotification == null)
                    {
                        MeteredNotification = this.Notifications.CreateNotification("MeteredNotification", "On metered connection", "Warning");
                    }
                    if (MeteredNotification != null && MeteredNotification.GetHeight() == 0)
                    {
                        MeteredNotification.ShowNotification();
                    }
                }
                break;

            case "Wifi":
                ConnectionDismiss = false;
                if (NoInternetConnection != null && NoInternetConnection.GetHeight() > 0)
                {
                    NoInternetConnection.DestroyNotification();
                }
                if (MeteredNotification != null && MeteredNotification.GetHeight() > 0)
                {
                    MeteredNotification.DestroyNotification();
                }
                break;

            default:
                break;
            }

            return(true);
        }
示例#2
0
 public static void DestroyNotification(this NotificationControl Notification)
 {
     Notification.DestroyNotification(null, null);
     Notification = null;
 }