private void ListProperties(Contact cContact) { Console.WriteLine("ID=" + cContact.ID); Console.WriteLine("USERNAME="******"") { Console.WriteLine("FN=" + cContact.FN); } IABList nList = cContact.GetNames(); foreach(Name cName in nList) { Console.Write("N=("); Console.Write("ID=" + cName.ID); if (cName.Prefix != "") { Console.Write(";Prefix="); Console.Write(cName.Prefix); } if (cName.Given != "") { Console.Write(";Given="); Console.Write(cName.Given); } if (cName.Other != "") { Console.Write(";Other="); Console.Write(cName.Other); } if (cName.Family != "") { Console.Write(";Family="); Console.Write(cName.Family); } if (cName.Suffix != "") { Console.Write(";Suffix="); Console.Write(cName.Suffix); } if (cName.Preferred == true) { Console.Write(";PREF"); } Console.WriteLine(")"); } if (cContact.Nickname != "") { Console.WriteLine("NICKNAME=" + cContact.Nickname); } if (cContact.Title != "") { Console.WriteLine("TITLE=" + cContact.Title); } if (cContact.Role != "") { Console.WriteLine("ROLE=" + cContact.Role); } IABList mList = cContact.GetEmailAddresses(); foreach(Email tMail in mList) { Console.Write("EMAIL=" + tMail.Address); if (tMail.Preferred == true) { Console.Write(";PREF"); } if ((tMail.Types & EmailTypes.work) == EmailTypes.work) { Console.Write(";WORK"); } if ((tMail.Types & EmailTypes.personal) == EmailTypes.personal) { Console.Write(";PERSONAL"); } if ((tMail.Types & EmailTypes.internet) == EmailTypes.internet) { Console.Write(";INTERNET"); } if ((tMail.Types & EmailTypes.x400) == EmailTypes.x400) { Console.Write(";X.400"); } Console.WriteLine(""); } IABList tList = cContact.GetTelephoneNumbers(); foreach(Telephone tPhone in tList) { Console.Write("TEL=" + tPhone.Number); if (tPhone.Preferred == true) { Console.Write(";PREF"); } if ((tPhone.Types & PhoneTypes.home) == PhoneTypes.home) { Console.Write(";HOME"); } if ((tPhone.Types & PhoneTypes.work) == PhoneTypes.work) { Console.Write(";WORK"); } if ((tPhone.Types & PhoneTypes.other) == PhoneTypes.other) { Console.Write(";OTHER"); } if ((tPhone.Types & PhoneTypes.cell) == PhoneTypes.cell) { Console.Write(";CELL"); } if ((tPhone.Types & PhoneTypes.voice) == PhoneTypes.voice) { Console.Write(";VOICE"); } if ((tPhone.Types & PhoneTypes.fax) == PhoneTypes.fax) { Console.Write(";FAX"); } if ((tPhone.Types & PhoneTypes.msg) == PhoneTypes.msg) { Console.Write(";MSG"); } if ((tPhone.Types & PhoneTypes.bbs) == PhoneTypes.bbs) { Console.Write(";BBS"); } if ((tPhone.Types & PhoneTypes.car) == PhoneTypes.car) { Console.Write(";CAR"); } if ((tPhone.Types & PhoneTypes.isdn) == PhoneTypes.isdn) { Console.Write(";ISDN"); } if ((tPhone.Types & PhoneTypes.modem) == PhoneTypes.modem) { Console.Write(";MODEM"); } if ((tPhone.Types & PhoneTypes.pager) == PhoneTypes.pager) { Console.Write(";PAGER"); } if ((tPhone.Types & PhoneTypes.pcs) == PhoneTypes.pcs) { Console.Write(";PCS"); } if ((tPhone.Types & PhoneTypes.video) == PhoneTypes.video) { Console.Write(";VIDEO"); } if ((tPhone.Types & PhoneTypes.voip) == PhoneTypes.voip) { Console.Write(";VOIP"); } Console.WriteLine(""); } if (cContact.Organization != "") { Console.WriteLine("ORG=" + cContact.Organization); } if (cContact.WorkForceID != "") { Console.WriteLine("WORKFORCEID=" + cContact.WorkForceID); } if (cContact.ManagerID != "") { Console.WriteLine("MANAGERID=" + cContact.ManagerID); } if (cContact.Birthday != "") { Console.WriteLine("BDAY=" + cContact.Birthday); } if (cContact.Blog != "") { Console.WriteLine("BLOG=" + cContact.Blog); } if (cContact.Url != "") { Console.WriteLine("URL=" + cContact.Url); } IABList aList = cContact.GetAddresses(); foreach(Address cAddress in aList) { Console.Write("ADR=("); if (cAddress.ID != "") { Console.Write("ID=" + cAddress.ID); } if (cAddress.Street != "") { Console.Write(";STREET=" + cAddress.Street); } if (cAddress.Locality != "") { Console.Write(";LOCALITY=" + cAddress.Locality); } if (cAddress.Region != "") { Console.Write(";REGION=" + cAddress.Region); } if (cAddress.PostalCode != "") { Console.Write(";PCODE=" + cAddress.PostalCode); } if (cAddress.PostalBox != "") { Console.Write(";PBOX=" + cAddress.PostalBox); } if (cAddress.Country != "") { Console.Write(";COUNTRY=" + cAddress.Country); } if (cAddress.Types != 0) { if ((cAddress.Types & AddressTypes.preferred) == AddressTypes.preferred) { Console.Write(";PREF"); } if ((cAddress.Types & AddressTypes.home) == AddressTypes.home) { Console.Write(";HOME"); } if ((cAddress.Types & AddressTypes.work) == AddressTypes.work) { Console.Write(";WORK"); } if ((cAddress.Types & AddressTypes.other) == AddressTypes.other) { Console.Write(";OTHER"); } if ((cAddress.Types & AddressTypes.postal) == AddressTypes.postal) { Console.Write(";POSTAL"); } if ((cAddress.Types & AddressTypes.parcel) == AddressTypes.parcel) { Console.Write(";PARCEL"); } if ((cAddress.Types & AddressTypes.dom) == AddressTypes.dom) { Console.Write(";DOM"); } if ((cAddress.Types & AddressTypes.intl) == AddressTypes.intl) { Console.Write(";INTL"); } } Console.WriteLine(")"); } if (cContact.Note != "") { Console.WriteLine("NOTE=" + cContact.Note); } }
public void DisplayContactDetails(Contact c) { bool addBlank = false; ClearContactDetails(); if(c != null) { Pixbuf cPhoto = GetScaledPhoto(c, 64); if(cPhoto != null) AddPicture(cPhoto); else AddPicture(BlankHeadPixBuf); if(c.FN != null) { AddTitles(c.FN, c.Title, null); } else { AddTitles(c.UserName, c.Title, null); } foreach(Telephone phone in c.GetTelephoneNumbers()) { addBlank = true; if((phone.Types & PhoneTypes.home) == PhoneTypes.home) { AddLabeledValue("home", phone.Number); } if((phone.Types & PhoneTypes.work) == PhoneTypes.work) { AddLabeledValue("work", phone.Number); } if((phone.Types & PhoneTypes.other) == PhoneTypes.other) { AddLabeledValue("other", phone.Number); } if((phone.Types & PhoneTypes.cell) == PhoneTypes.cell) { AddLabeledValue("mobile", phone.Number); } if((phone.Types & PhoneTypes.pager) == PhoneTypes.pager) { AddLabeledValue("pager", phone.Number); } if((phone.Types & PhoneTypes.fax) == PhoneTypes.fax) { AddLabeledValue("fax", phone.Number); } } if(addBlank) { AddLabeledValue(null, null); addBlank = false; } foreach(Email e in c.GetEmailAddresses()) { addBlank = true; if((e.Types & EmailTypes.personal) == EmailTypes.personal) { AddLabeledValue("home", e.Address); } if((e.Types & EmailTypes.work) == EmailTypes.work) { AddLabeledValue("work", e.Address); } if((e.Types & EmailTypes.other) == EmailTypes.other) { AddLabeledValue("other", e.Address); } } if(addBlank) { AddLabeledValue(null, null); addBlank = false; } foreach(IM im in c.GetInstantMessageAccounts()) { addBlank = true; if((im.Types & IMTypes.home) == IMTypes.home) { AddLabeledValue("home", im.Address + " (" + im.Provider + ")"); } if((im.Types & IMTypes.work) == IMTypes.work) { AddLabeledValue("work", im.Address + " (" + im.Provider + ")"); } if((im.Types & IMTypes.other) == IMTypes.other) { AddLabeledValue("other", im.Address + " (" + im.Provider + ")"); } } if(addBlank) { AddLabeledValue(null, null); addBlank = false; } foreach(Address addr in c.GetAddresses()) { string addressLine = ""; if((addr.Types & AddressTypes.home) == AddressTypes.home) { if(addr.Street != null) AddLabeledValue("home", addr.Street); } else if((addr.Types & AddressTypes.work) == AddressTypes.work) { if(addr.Street != null) AddLabeledValue("work", addr.Street); } else { if(addr.Street != null) AddLabeledValue("other", addr.Street); } if((addr.MailStop != null) && (addr.MailStop.Length > 0)) AddLabeledValue(null, "MS: " + addr.MailStop); if(addr.Locality != null) addressLine = addr.Locality + " "; if(addr.Region != null) addressLine += addr.Region + " "; if(addr.PostalCode != null) addressLine += addr.PostalCode + " "; if(addressLine.Length > 0) AddLabeledValue(null, addressLine); if((addr.Country != null) && (addr.Country.Length > 0)) AddLabeledValue(null, addr.Country); AddLabeledValue(null, null); } } }