//constructor public Member(String name, String phone, String address, MembershipType type, int year) { Name = name; Phone = phone; Address = address; MemberShipType = type; YearJoined = year; }
//window loaded, initialise list of members & combobox private void Window_Loaded(object sender, RoutedEventArgs e) { randomFactory = new Random(); members = new List <Member>(); //create type objects MembershipType full = new MembershipType("Full"); MembershipType offPeak = new MembershipType("Off Peak"); MembershipType student = new MembershipType("Student"); MembershipType oap = new MembershipType("OAP"); //creating members using constructors Member m1 = new Member( "Ted Crilly", "087 123 4567", "1 O Connell St. Sligo", full, GenerateRandomDate(16, 1) ); members.Add(m1); Member m2 = new Member( "Dougal Maguire", "087 321 6547", "1 Main St. Sligo", student, GenerateRandomDate(16, 1) ); members.Add(m2); Member m3 = new Member( "Jack Hackett", "087 123 4567", "27 Caltragh Heights Sligo", oap, GenerateRandomDate(16, 1) ); members.Add(m3); Member m4 = new Member( "Jesse Bloggs", "087 788 1441", "33 Diagon Alley Sligo", oap, GenerateRandomDate(16, 1) ); members.Add(m4); Member m5 = new Member( "Mrs Doyle", "087 788 1441", "33 Wizard Lane", offPeak, GenerateRandomDate(16, 1) ); members.Add(m5); //set source of list box lbxMembers.ItemsSource = members; //set source of combo box cbxMemberType.ItemsSource = GetMemberhipTypes(); }