Exemplo n.º 1
0
        public ucPetCard(ClaPet newPet)
        {
            InitializeComponent();

            //save the pass data into the card
            currentPet = newPet;

            //update the visual display on the card
            lblBreed.Content   = currentPet.strBreed;
            lblOwner.Content   = currentPet.strOwner;
            lblPetName.Content = currentPet.strPetName;
        }
Exemplo n.º 2
0
        public winPet(ClaPet newPet)
        {
            InitializeComponent();

            currentPet = newPet;

            //update the visual display with the current pet detail
            lblOwner.Content    = currentPet.strOwner;
            lblPetName.Content  = currentPet.strPetName;
            lblBreed.Content    = currentPet.strBreed;
            lblCategory.Content = currentPet.strCategory;
            lblDOB.Content      = currentPet.datDOB.ToString("dddd, dd MMMM yyyy");

            //update the image
            string source = @"Pictures\" + currentPet.strBreed + @"\" + currentPet.strPetName + currentPet.strOwner + @".jfif";

            imgPicture.Source = new BitmapImage(new Uri(source, UriKind.Relative));
        }
Exemplo n.º 3
0
        public winLoggedIn()
        {
            InitializeComponent();

            //create a hashset for the breeds
            HashSet <string> hshBreeds = new HashSet <string>();

            //Read from the pets txt file
            string[] arrLines = System.IO.File.ReadAllLines(@"Pets.txt");

            //Split each line part
            foreach (string line in arrLines)
            {
                //create parts array
                string[] arrParts = line.Split(',');

                //create
                ClaPet newPet = new ClaPet();

                newPet.strOwner    = arrParts[0];
                newPet.strPetName  = arrParts[1];
                newPet.strBreed    = arrParts[2];
                newPet.strCategory = arrParts[3];
                newPet.datDOB      = Convert.ToDateTime(arrParts[4]);

                //add the breed to the hashset
                hshBreeds.Add(newPet.strBreed);

                //create the user control
                ucPetCard newCard = new ucPetCard(newPet);

                //add to list of pets
                claDataStore.lstPets.Add(newCard);
            }

            foreach (string Breed in hshBreeds)
            {
                lsbBreeds.Items.Add(Breed);
            }
        }