public ContactsWindow(ClientForm clientForm, NTContact selectedMyContact, Hashtable properties) { InitializeComponent(); this.ClientSize = this.Size; this.MaximizeBox = false; this.MaximumSize = this.Size; myClientForm = clientForm; myRPhoneBook = myClientForm.myContactsBook; try { if (selectedMyContact != null) { myNTContact = selectedMyContact; } else { myNTContact = new NTContact(); } myContactJabberIDListBox.Items.Clear(); myContactJabberIDListBox.Items.Add(""); myContactJabberGroupListBox.Items.Clear(); myContactJabberGroupListBox.Items.Add(""); myContactFirstNameInput.Text = myNTContact.NTFirstName; myContactMiddleNameInput.Text = myNTContact.NTMiddleName; myContactLastNameInput.Text = myNTContact.NTLastName; myContactPhoneHomeInput.Text = myNTContact.NTHomeTelephoneNumber; myContactPhoneMobileInput.Text = myNTContact.NTMobileTelephoneNumber; myContactPhoneBusinessInput.Text = myNTContact.NTBusinessTelephoneNumber; myContactPhoneVoIPInput.Text = myNTContact.NTVoIPTelephoneNumber; myContactJabberIDListBox.SelectedText = myNTContact.NTJabberID; myContactAddressStreetInput.Text = myNTContact.NTHomeAddressStreet; myContactAddressCityInput.Text = myNTContact.NTHomeAddressCity; myContactAddressZipCodeInput.Text = myNTContact.NTHomeAddressPostalCode; myContactAddressStateInput.Text = myNTContact.NTHomeAddressState; myContactAddressCountryInput.Text = myNTContact.NTHomeAddressCountry; myContactAddressEmailInput.Text = myNTContact.NTEmail1Address; if (properties != null) { myContactFirstNameInput.Text = properties["NTFirstName"] != null ? properties["NTFirstName"].ToString() : myNTContact.NTFirstName; myContactMiddleNameInput.Text = properties["NTMiddleName"] != null ? properties["NTMiddleName"].ToString() : myNTContact.NTMiddleName; myContactLastNameInput.Text = properties["NTLastName"] != null ? properties["NTLastName"].ToString() : myNTContact.NTLastName; myContactPhoneHomeInput.Text = properties["NTHomeTelephoneNumber"] != null ? properties["NTHomeTelephoneNumber"].ToString() : myNTContact.NTHomeTelephoneNumber; myContactPhoneMobileInput.Text = properties["NTMobileTelephoneNumber"] != null ? properties["NTMobileTelephoneNumber"].ToString() : myNTContact.NTMobileTelephoneNumber; myContactPhoneBusinessInput.Text = properties["NTBusinessTelephoneNumber"] != null ? properties["NTBusinessTelephoneNumber"].ToString() : myNTContact.NTBusinessTelephoneNumber; myContactPhoneVoIPInput.Text = properties["NTVoIPTelephoneNumber"] != null ? properties["NTVoIPTelephoneNumber"].ToString() : myNTContact.NTVoIPTelephoneNumber; myContactJabberIDListBox.SelectedText = properties["NTJabberID"] != null ? properties["NTJabberID"].ToString() : myNTContact.NTJabberID; myContactAddressStreetInput.Text = properties["NTHomeAddressStreet"] != null ? properties["NTHomeAddressStreet"].ToString() : myNTContact.NTHomeAddressStreet; myContactAddressCityInput.Text = properties["NTHomeAddressCity"] != null ? properties["NTHomeAddressCity"].ToString() : myNTContact.NTHomeAddressCity; myContactAddressZipCodeInput.Text = properties["NTHomeAddressPostalCode"] != null ? properties["NTHomeAddressPostalCode"].ToString() : myNTContact.NTHomeAddressPostalCode; myContactAddressStateInput.Text = properties["NTHomeAddressState"] != null ? properties["NTHomeAddressState"].ToString() : myNTContact.NTHomeAddressState; myContactAddressCountryInput.Text = properties["NTHomeAddressCountry"] != null ? properties["NTHomeAddressCountry"].ToString() : myNTContact.NTHomeAddressCountry; myContactAddressEmailInput.Text = properties["NTEmail1Address"] != null ? properties["NTEmail1Address"].ToString() : myNTContact.NTEmail1Address; } foreach (DictionaryEntry buddy in myClientForm.myBuddyList) { myContactJabberIDListBox.Items.Add(buddy.Key.ToString()); myContactJabberGroupListBox.Items.Add(buddy.Value.ToString()); if (myContactJabberIDListBox.Text == buddy.Key.ToString()) { myContactJabberIDListBox.SelectedIndex = myContactJabberIDListBox.Items.Count - 1; myContactJabberGroupListBox.SelectedIndex = myContactJabberGroupListBox.Items.Count - 1; } } } catch (Exception) { // throw; } }