예제 #1
0
        private void Refresh()
        {
            if (InternetActive())
            {
                //Update values
                api = new MyTicketApi();
                var unreadAndOpen = api.GetUnreadAndOpen();

                UnreadNumber.Text = unreadAndOpen.Unread.ToString();
                OpenNumber.Text   = unreadAndOpen.Open.ToString();
            }
            else
            {
                //Display notification internet error
                Notification notification = new Notification
                {
                    Title   = "No internet",
                    Content = "Enable your internet connexion before using this app.",
                    Tag     = "internet is offline"
                };

                NotificationManager.Post(notification);

                NotificationManager.DeleteAll();
            }
        }
예제 #2
0
        public TextListPage(MyTicketApi api, int type = 0)
        {
            InitializeComponent();

            // Initialize sample data and set ItemsSource in ListView.
            // TODO: Change ItemsSource with your own data.
            if (api != null)
            {
                this.api = api;
                var lt = api.GetTicketList(type);

                if (lt.Count > 0)
                {
                    listView.ItemsSource        = lt;
                    listView.IsVisible          = true;
                    noTicketLabel.IsVisible     = false;
                    stackLayout.BackgroundColor = Color.Black;
                }
                else
                {
                    listView.IsVisible          = false;
                    noTicketLabel.IsVisible     = true;
                    stackLayout.BackgroundColor = Color.FromHex("#21D192");
                }
            }
        }