Exemple #1
0
        public NewWindow(string selected, List <PersonEntry> listOfEntries)
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            int         counter = 0;
            PersonEntry pe      = null;

            while (counter < listOfEntries.Count())
            {
                if (listOfEntries[counter].FullName == selected)
                {
                    pe                  = listOfEntries[counter];
                    this.Title          = pe.FullName + "'s Information"; //title of the window to be changed
                    lblFullname.Content = pe.FullName;
                    lblEmail.Content    = pe.EmailAddr;
                    lblPhone.Content    = pe.PhoneNum;
                    break;
                }
                else
                {
                    counter++;
                }
            }
        }
Exemple #2
0
        public void readFromFile()
        {
            List <string>      temp      = new List <string>();
            List <PersonEntry> tempEntry = new List <PersonEntry>();
            PersonEntry        pe        = null;

            using (StreamReader sr = new StreamReader("../../People.txt"))
            {
                String currentLine;
                // Read the stream to a string, and write the string to the console.
                while ((currentLine = sr.ReadLine()) != null)
                {
                    pe          = new PersonEntry();
                    pe.FullName = currentLine;
                    temp.Add(currentLine);

                    pe.EmailAddr = sr.ReadLine();
                    pe.PhoneNum  = sr.ReadLine();
                    tempEntry.Add(pe);
                }
            }
            PersonList      = temp;
            PersonEntryList = tempEntry;
        }