MobileForms Toolkit Documentation

PhoneBook Class

Represents the SIM card phone book

For a list of all members of this type, see PhoneBook Members.

System.Object
   Resco.Phone.SIM.PhoneBook

public class PhoneBook : IEnumerable

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The Sim object provides a set of properties which are getting the SIM card phone books. There are several types of phone books stored on the SIM card: General phone book containing the card owner's contacts Emergency phone book containing one or more emergency numbers which are typically read only and do not contain the name information Fixed dialing list containing several predefined readonly records Last dialed numbers list which typically contains 10 records which are read only and do not contain the name information. Own numbers list which typically contains only a single editable record which may contain the phone owner's name and number.

The PhoneBook entries may not be stored sequentially. Thus you can obtain several Empty between a valid records. If you will obtain the null record, it means that the index is out of the valid index range or the SIM card is not accessible. bool IndexIsEmpty( PhoneBook pb, int index ) { PhoneBookEntry entry = pb[index]; if ( entry==null ) throw new Exception(pb.LastError); // either the index is out of range or the SIM is not ready return entry==PhoneBookEntry.Empty; }

The PhoneBook class implements the IEnumerable interface and thus can enumerate using foreach syntax: List<PhoneBookEntry> GetPhoneBookEntries(PhoneBook pb) { var list = new List<PhoneBookEntry>(); foreach(PhoneBookEntry entry in pb) list.Add(entry); return list; } An advantage of using the foreach (or IEnumerator) enumeration is that it skips the empty records and you will obtain only a valid records.

Requirements

Namespace: Resco.Phone.SIM

Assembly: Resco.Phone.CF3 (in Resco.Phone.CF3.dll)

See Also

PhoneBook Members | Resco.Phone.SIM Namespace