Example #1
0
        private async void refresh()
        {
            await u.setInfo(token, u.id_user);

            IList <Ticket> tickets = u.owned_tickets;

            if (u.cm == 0)
            {
                ;
            }
            else
            {
                foreach (var t in tickets)
                {
                    if (t.type == 2)
                    {
                        this.complete = t;
                    }
                }
            }

            if (u.sm == 0)
            {
                ;
            }
            else
            {
                foreach (var t in tickets)
                {
                    if (t.type == 1)
                    {
                        this.simple = t;
                    }
                }
            }

            if (leftt == 0)
            {
                right.Opacity = 0.5;
                left.Opacity  = 1;
                if (u.sm == 1)
                {
                    meals.Text          = "YOU HAVE " + u.sm.ToString() + " SIMPLE MEAL AVAILABLE"; barcod.Opacity = 1;
                    barcod.BarcodeValue = simple.id_ticket + " " + simple.id_user;
                }
                else if (u.sm != 0)
                {
                    meals.Text          = "YOU HAVE " + u.sm.ToString() + " SIMPLE MEALS AVAILABLE"; barcod.Opacity = 1;
                    barcod.BarcodeValue = simple.id_ticket + " " + simple.id_user;
                }
                else
                {
                    barcod.Opacity = 0.5;
                    meals.Text     = "YOU HAVE 0 SIMPLE MEALS AVAILABLE";
                }
            }
            else if (leftt == 1)
            {
                right.Opacity = 1;
                left.Opacity  = 0.5;
                if (u.cm == 1)
                {
                    meals.Text          = "YOU HAVE " + u.cm.ToString() + " COMPLETE MEAL AVAILABLE"; barcod.Opacity = 1;
                    barcod.BarcodeValue = complete.id_ticket + " " + complete.id_user;
                }
                else if (u.cm != 0)
                {
                    meals.Text          = "YOU HAVE " + u.cm.ToString() + " COMPLETE MEALS AVAILABLE"; barcod.Opacity = 1;
                    barcod.BarcodeValue = complete.id_ticket + " " + complete.id_user;
                }
                else
                {
                    barcod.Opacity = 0.5;
                    meals.Text     = "YOU HAVE 0 COMPLETE MEALS AVAILABLE";
                }
            }
        }
Example #2
0
        private async void onLeftButtonClicked(object sender, EventArgs args)
        {
            if (SystemClock.ElapsedRealtime() - LastButtonClickTime < 1000)
            {
                return;
            }
            LastButtonClickTime = SystemClock.ElapsedRealtime();
            this.leftt          = 1;
            //refresh user info with new ticke
            await u.setInfo(token, u.id_user);

            IList <Ticket> tickets = u.owned_tickets;

            if (u.cm == 0)
            {
                ;
            }
            else
            {
                foreach (var t in tickets)
                {
                    if (t.type == 2)
                    {
                        this.complete = t;
                    }
                }
            }

            if (u.sm == 0)
            {
                ;
            }
            else
            {
                foreach (var t in tickets)
                {
                    if (t.type == 1)
                    {
                        this.simple = t;
                    }
                }
            }



            right.Opacity = 1;
            left.Opacity  = 0.5;
            if (u.cm == 1)
            {
                meals.Text          = "YOU HAVE " + u.cm.ToString() + " COMPLETE MEAL AVAILABLE"; barcod.Opacity = 1;
                barcod.BarcodeValue = complete.id_ticket + " " + complete.id_user;
            }
            else if (u.cm != 0)
            {
                meals.Text          = "YOU HAVE " + u.cm.ToString() + " COMPLETE MEALS AVAILABLE"; barcod.Opacity = 1;
                barcod.BarcodeValue = complete.id_ticket + " " + complete.id_user;
            }
            else
            {
                barcod.Opacity = 0.5;
                meals.Text     = "YOU HAVE 0 COMPLETE MEALS AVAILABLE";
            }
        }