Esempio n. 1
0
        public async void CountContact(string function, string emergency)
        {
            int             contactCount = 0;
            ContactDatabase db           = new ContactDatabase(dbPath);

            contactCount = await db.CountContact(emergency);

            if (contactCount > 0)
            {
                if (function == "Init")
                {
                    ShowContact(emergency);
                }
            }

            else
            {
                noContact.IsVisible = true;
                contacts.IsVisible  = false;
            }
            //
        }
Esempio n. 2
0
        public async void CheckEmergency(string mode)
        {
            string[] emergencies = { "Police", "Medical", "Fire", "Personal" };
            if (mode == "Emergency Mode")
            {
                foreach (string value in emergencies)
                {
                    ContactDatabase db  = new ContactDatabase(dbPath);
                    var             _db = await db.CountContact(value);

                    if (_db > 0)
                    {
                        switch (value)
                        {
                        case "Police":
                            Police.Source        = "police.png";
                            PoliceText.TextColor = Color.White;
                            break;

                        case "Medical":
                            Medical.Source        = "medical.png";
                            MedicalText.TextColor = Color.White;
                            break;

                        case "Fire":
                            Fire.Source        = "fire.png";
                            FireText.TextColor = Color.White;
                            break;

                        case "Personal":
                            Personal.Source        = "family.png";
                            PersonalText.TextColor = Color.White;
                            break;
                        }
                    }
                    else
                    {
                        switch (value)
                        {
                        case "Police":
                            Police.Source        = "policeX.png";
                            PoliceText.TextColor = Color.SlateGray;
                            break;

                        case "Medical":
                            Medical.Source        = "medicalX.png";
                            MedicalText.TextColor = Color.SlateGray;
                            break;

                        case "Fire":
                            Fire.Source        = "fireX.png";
                            FireText.TextColor = Color.SlateGray;
                            break;

                        case "Personal":
                            Personal.Source        = "familyX.png";
                            PersonalText.TextColor = Color.SlateGray;
                            break;
                        }
                    }
                }
            }

            else
            {
                foreach (string value in emergencies)
                {
                    switch (value)
                    {
                    case "Police":
                        Police.Source        = "police.png";
                        PoliceText.TextColor = Color.White;
                        break;

                    case "Medical":
                        Medical.Source        = "medical.png";
                        MedicalText.TextColor = Color.White;
                        break;

                    case "Fire":
                        Fire.Source        = "fire.png";
                        FireText.TextColor = Color.White;
                        break;

                    case "Personal":
                        Personal.Source        = "family.png";
                        PersonalText.TextColor = Color.White;
                        break;
                    }
                }
            }
        }