protected override void OnDisappearing()
 {
     base.OnDisappearing();
     MessagesFooter.ActiveMessages(false);
     if (MessagesListView.SelectedItem == null)
     {
         return;
     }
     MessagesListView.SelectedItem = null;
     if (TopSecretTabPage.SelectedItem == null)
     {
         return;
     }
     TopSecretTabPage.SelectedItem = null;
 }
        protected override void OnAppearing()
        {
            base.OnAppearing();
            TopSecretTabPage.ItemsSource     = Global.GetTopUnreadTest();
            TopSecretTabPage.SelectedItem    = null;
            MessagesFooter.BadgeCountMessage = "0";
            MessagesFooter.SetRewardLevelIcon(Global.GetrewardPoints());
            if (Global.GetAllTopic().Any())
            {
                Global.SetAllTopic(RemoveAllMessageNotif());

                Global.SetNotifBadge(Global.GetAllTopic().Where(e => e.Value == "new_message").Count());
                CrossBadge.Current.SetBadge(Global.GetNotifCount());
                Global.SetMessageCount(0);
            }
            else
            {
                var list = RemoveAllMessageNotif();
                Global.SetNotifBadge(Global.GetNotifCount() - list.Where(e => e.Value == "new_message").Count());
                CrossBadge.Current.SetBadge(Global.GetNotifCount());
                Global.SetMessageCount(0);
            }

            var notifList           = Global.GetAllTopic();
            var currentMessageCount = notifList.Where(e => e.Value == "new_message").Count();

            if (currentMessageCount <= 0)
            {
                MessagesFooter.BadgeVisibility = 0;
            }
            else
            {
                MessagesFooter.BadgeVisibility   = 1;
                MessagesFooter.BadgeCountMessage = currentMessageCount.ToString();
            }
            MessagesFooter.ActiveMessages(true);
            MessagesFooter.SetRewardLevelIcon(Global.GetrewardPoints());
        }