private void btnChangePicture_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (DialogResult.OK == fileDialog.ShowDialog()) { if (fileDialog.FileName != null) { //Processimge try { myContactPicture.Image = ImageProcessing.FixedSize(new Bitmap(fileDialog.FileName), 64, 64); myNTContact.NTPicture = ImageProcessing.ToString(myContactPicture.Image); } catch (Exception) { #if (DEBUG) throw; #endif } } } }
private void LoadContact(NTContact selectedMyContact) { if (selectedMyContact != null) { mNTContact = selectedMyContact; } else { mNTContact = new NTContact(); } myContactJabberGroupListBox.Items.Clear(); myContactJabberGroupListBox.Items.Add(""); myContactJabberIMNetworkListBox.DataSource = Enum.GetValues(typeof(ConfigXMPPNetwork)); myContactJabberIMNetworkListBox.SelectedIndex = 0; myContactStoreComboBox.Items.Clear(); foreach (NTContactStore store in myClientForm.mContactBook.ContactStores) { if (store.Enabled) { myContactStoreComboBox.Items.Add(store); } if (mNTContact.NTContactStore == store.StoreType) { myContactStoreComboBox.SelectedItem = store; } } myContactJabberIDInput.Text = mNTContact.NTJabberID; myContactFirstNameInput.Text = mNTContact.NTFirstName; myContactMiddleNameInput.Text = mNTContact.NTMiddleName; myContactLastNameInput.Text = mNTContact.NTLastName; myContactPhoneHomeInput.Text = mNTContact.NTHomeTelephoneNumber; myContactPhoneMobileInput.Text = mNTContact.NTMobileTelephoneNumber; myContactPhoneBusinessInput.Text = mNTContact.NTBusinessTelephoneNumber; myContactPhoneVoIPInput.Text = mNTContact.NTVoIPTelephoneNumber; myContactJabberIDInput.Text = mNTContact.NTJabberID; myContactAddressStreetInput.Text = mNTContact.NTHomeAddressStreet; myContactAddressCityInput.Text = mNTContact.NTHomeAddressCity; myContactAddressZipCodeInput.Text = mNTContact.NTHomeAddressPostalCode; myContactAddressStateInput.Text = mNTContact.NTHomeAddressState; myContactAddressCountryInput.Text = mNTContact.NTHomeAddressCountry; myContactAddressEmailInput.Text = mNTContact.NTEmail1Address; try { myContactPicture.Image = myContactPicture.Image = ImageProcessing.FixedSize(ImageProcessing.FromString(mNTContact.NTPicture), 64, 64); } catch (Exception) { } if (mProperties != null) { myContactFirstNameInput.Text = mProperties["NTFirstName"] != null ? mProperties["NTFirstName"].ToString() : mNTContact.NTFirstName; myContactMiddleNameInput.Text = mProperties["NTMiddleName"] != null ? mProperties["NTMiddleName"].ToString() : mNTContact.NTMiddleName; myContactLastNameInput.Text = mProperties["NTLastName"] != null ? mProperties["NTLastName"].ToString() : mNTContact.NTLastName; myContactPhoneHomeInput.Text = mProperties["NTHomeTelephoneNumber"] != null ? mProperties["NTHomeTelephoneNumber"].ToString() : mNTContact.NTHomeTelephoneNumber; myContactPhoneMobileInput.Text = mProperties["NTMobileTelephoneNumber"] != null ? mProperties["NTMobileTelephoneNumber"].ToString() : mNTContact.NTMobileTelephoneNumber; myContactPhoneBusinessInput.Text = mProperties["NTBusinessTelephoneNumber"] != null ? mProperties["NTBusinessTelephoneNumber"].ToString() : mNTContact.NTBusinessTelephoneNumber; myContactPhoneVoIPInput.Text = mProperties["NTVoIPTelephoneNumber"] != null ? mProperties["NTVoIPTelephoneNumber"].ToString() : mNTContact.NTVoIPTelephoneNumber; myContactJabberIDInput.Text = mProperties["NTJabberID"] != null ? mProperties["NTJabberID"].ToString() : mNTContact.NTJabberID; myContactAddressStreetInput.Text = mProperties["NTHomeAddressStreet"] != null ? mProperties["NTHomeAddressStreet"].ToString() : mNTContact.NTHomeAddressStreet; myContactAddressCityInput.Text = mProperties["NTHomeAddressCity"] != null ? mProperties["NTHomeAddressCity"].ToString() : mNTContact.NTHomeAddressCity; myContactAddressZipCodeInput.Text = mProperties["NTHomeAddressPostalCode"] != null ? mProperties["NTHomeAddressPostalCode"].ToString() : mNTContact.NTHomeAddressPostalCode; myContactAddressStateInput.Text = mProperties["NTHomeAddressState"] != null ? mProperties["NTHomeAddressState"].ToString() : mNTContact.NTHomeAddressState; myContactAddressCountryInput.Text = mProperties["NTHomeAddressCountry"] != null ? mProperties["NTHomeAddressCountry"].ToString() : mNTContact.NTHomeAddressCountry; myContactAddressEmailInput.Text = mProperties["NTEmail1Address"] != null ? mProperties["NTEmail1Address"].ToString() : mNTContact.NTEmail1Address; } foreach (DictionaryEntry group in myClientForm.myBuddyGroups) { if (group.Value.ToString() != "" && !myContactJabberGroupListBox.Items.Contains(group.Value.ToString())) { myContactJabberGroupListBox.Items.Add(group.Value.ToString()); } } JabberUser jabberUser = null; if (myContactJabberIDInput.Text != "") { jabberUser = new JabberUser(myContactJabberIDInput.Text); myContactJabberIDInput.Text = jabberUser.Username; myContactJabberIMNetworkListBox.SelectedItem = jabberUser.Network; myContactJabberGroupListBox.Text = myClientForm.myBuddyList[jabberUser.JID] != null ? myClientForm.myBuddyList[jabberUser.JID].ToString() : Properties.Localization.txtOtherGroup; } if (myClientForm.mUserAccount.Username == myContactJabberIDInput.Text) { myContactJabberIDInput.Enabled = false; myContactJabberGroupBox.Visible = false; myContactStoreComboBox.Enabled = false; myContactStoreComboBox.Visible = false; labelStore.Visible = false; } }