示例#1
0
        private void RefreshContact()
        {
            if (theContact != null)
            {
                theFirstNameTextBox.Text    = theContact.FirstName;
                theLastNameTextBox.Text     = theContact.LastName;
                theCreationDateLabel.Text   = theContact.CreationDate.ToString();
                theLastUpdateDateLabel.Text = theContact.LastUpdateDate.ToString();
                StringBuilder emails = new StringBuilder();
                foreach (var email in theContact.EmailAddresses)
                {
                    emails.AppendLine(email);
                }
                theEmailsTextBox.Text = emails.ToString();

                if (theContact.HasAttachment)
                {
                    this.imageAvatar.Image = Image.FromStream(Database.GetAttachment(theContact, theContact.GetAttachmentNames().First()));
                }
                else
                {
                    this.imageAvatar.Image = null;
                }
            }
            else
            {
                theFirstNameTextBox.Text    = String.Empty;
                theLastNameTextBox.Text     = String.Empty;
                theEmailsTextBox.Text       = String.Empty;
                theCreationDateLabel.Text   = String.Empty;
                theLastUpdateDateLabel.Text = String.Empty;
                imageAvatar.Image           = null;
            }
        }