コード例 #1
0
        void OnCurrentItemChanged(object sender, CurrentItemChangedEventArgs e)
        {
            ParentsCardInfo a = ( ParentsCardInfo )e.CurrentItem;

            if (a.Text[0] == 'R')
            {
                cvboxf.BackgroundColor  = Color.FromHex(onColor);
                cvboxs.BackgroundColor  = Color.FromHex(offColor);
                cvboxt.BackgroundColor  = Color.FromHex(offColor);
                cvboxfo.BackgroundColor = Color.FromHex(offColor);
            }
            if (a.Text [0] == 'A')
            {
                cvboxf.BackgroundColor  = Color.FromHex(offColor);
                cvboxs.BackgroundColor  = Color.FromHex(onColor);
                cvboxt.BackgroundColor  = Color.FromHex(offColor);
                cvboxfo.BackgroundColor = Color.FromHex(offColor);
            }
            if (a.Text [0] == 'T')
            {
                cvboxf.BackgroundColor  = Color.FromHex(offColor);
                cvboxs.BackgroundColor  = Color.FromHex(offColor);
                cvboxt.BackgroundColor  = Color.FromHex(onColor);
                cvboxfo.BackgroundColor = Color.FromHex(offColor);
            }
            if (a.Text [0] == 'F')
            {
                cvboxf.BackgroundColor  = Color.FromHex(offColor);
                cvboxs.BackgroundColor  = Color.FromHex(offColor);
                cvboxt.BackgroundColor  = Color.FromHex(offColor);
                cvboxfo.BackgroundColor = Color.FromHex(onColor);
            }
        }
コード例 #2
0
        public async Task getstudnetinfo()
        {
            cvboxf.BackgroundColor  = Color.FromHex(onColor);
            cvboxs.BackgroundColor  = Color.FromHex(offColor);
            cvboxt.BackgroundColor  = Color.FromHex(offColor);
            cvboxfo.BackgroundColor = Color.FromHex(offColor);
            string              url      = "https://api.shikkhanobish.com/api/Master/GetInfoByStudentID";
            HttpClient          client   = new HttpClient();
            string              jsonData = JsonConvert.SerializeObject(new { StudentID = parentinfo.StudentID });// T.D: have to add student ID
            StringContent       content  = new StringContent(jsonData, Encoding.UTF8, "application/json");
            HttpResponseMessage response = await client.PostAsync(url, content).ConfigureAwait(true);

            var result = await response.Content.ReadAsStringAsync().ConfigureAwait(true);

            student = JsonConvert.DeserializeObject <StudentClass> (result);
            await callInfo();

            List <ParentsCardInfo> Pci  = new List <ParentsCardInfo> ();
            ParentsCardInfo        pci1 = new ParentsCardInfo();
            ParentsCardInfo        pci2 = new ParentsCardInfo();
            ParentsCardInfo        pci3 = new ParentsCardInfo();
            ParentsCardInfo        pci4 = new ParentsCardInfo();

            pci1.ImageSource = "rechargeins.jpg";
            pci1.Text        = "Recharge Instruction";
            pci1.info        = "Send money to 01753202936 and use reference code: " + student.StudentID;
            pci1.TextColors  = "#FF000000";
            pci1.fontSize    = 13;
            Pci.Add(pci1);
            pci2.ImageSource = "savedmoney.jpg";
            pci2.Text        = "Account Balence";
            pci2.info        = "" + student.RechargedAmount + " Taka";
            pci2.TextColors  = "#FFFFFFFF";
            pci2.fontSize    = 18;
            Pci.Add(pci2);
            pci3.ImageSource = "spentmoney.jpg";
            pci3.Text        = "Total Spent";
            pci3.info        = totalSpent + " Taka";
            pci3.fontSize    = 18;
            pci3.TextColors  = "#FFFFFFFF";
            Pci.Add(pci3);
            pci4.ImageSource = "topsubject.jpg";
            pci4.Text        = "Favourite Subject";
            pci4.info        = topsub;
            pci4.TextColors  = "#FF000000";
            pci4.fontSize    = 18;
            Pci.Add(pci4);

            cv.ItemsSource         = Pci;
            cv.CurrentItemChanged += OnCurrentItemChanged;
        }