コード例 #1
0
ファイル: ContactListFragment.cs プロジェクト: MADMUC/TAP5050
        public void GetContactList(ContactListFragment fragment,ViewGroup rootview)
        {
            nn_activity.RunOnUiThread(()=>{
                fragment.AddSpinner(rootview,"Loading");
            });

                var book = new Xamarin.Contacts.AddressBook (nn_activity);
                book.ToList ().ForEach (p=>{
                    string name = "";
                    if (p.FirstName != null) {
                        name += p.FirstName+" ";
                    }
                    if (p.LastName != null) {
                        name += p.LastName;
                    }

                    List<Phone> phonelist = p.Phones.ToList ();
                    if (phonelist.Count > 0) {
                        foreach(var phone in phonelist){
                            if(phone.Type.Equals(Xamarin.Contacts.PhoneType.Mobile)){
                                ContactInfo info = new ContactInfo (name,phone.Number);
                                contactinfolist.Add (info);
                                break;
                            }

                        }
                    }
                }
                );
                nn_activity.RunOnUiThread(()=>{
                fragment.RemoveSpinner(rootview);
                fragment.adapter.notifycontactlistdatachange();
                });
        }
コード例 #2
0
ファイル: ContactListFragment.cs プロジェクト: MADMUC/TAP5050
        public void GetContactList(ContactListFragment fragment,ViewGroup rootview)
        {
            nn_activity.RunOnUiThread(()=>{
                fragment.AddSpinner(rootview,"Loading");
            });

                var book = new Xamarin.Contacts.AddressBook (nn_activity);
                List<Contact> list = book.ToList ();
                list.Sort (
                delegate(Contact x, Contact y)
                {
                    if (String.IsNullOrEmpty(x.FirstName) && String.IsNullOrEmpty(y.FirstName)) return 0;
                    else if (x.FirstName == null) return -1;
                    else if (y.FirstName == null) return 1;
                    else return x.FirstName.CompareTo(y.FirstName);
                });
                list.ForEach (p=>{
                    string name = "";
                    if (p.FirstName != null) {
                        name += p.FirstName+" ";
                    }
                    if (p.LastName != null) {
                        name += p.LastName;
                    }

                    List<Phone> phonelist = p.Phones.ToList ();
                    if (phonelist.Count > 0) {
                        foreach(var phone in phonelist){
                            if(phone.Type.Equals(Xamarin.Contacts.PhoneType.Mobile)){
                                ContactInfo info = new ContactInfo (name,phone.Number);
                                contactinfolist.Add (info);
                                break;
                            }

                        }
                    }
                }
                );
                nn_activity.RunOnUiThread(()=>{
                fragment.RemoveSpinner(rootview);
                fragment.adapter.notifycontactlistdatachange();
                });
        }
コード例 #3
0
ファイル: HomeScreen.cs プロジェクト: MADMUC/TAP5050
 //do not push fragment into stack
 //picker for select sms target
 public void ShowContactListPicker(EventCard eventcard,string Organization,string BuyTicketUrl,string LocationName)
 {
     if(!IsFinishing){
         var fragment =new ContactListFragment ();
         fragment.nn_eventcard = eventcard;
         fragment.nn_organization = Organization;
         fragment.nn_buyticketurl = BuyTicketUrl;
         fragment.nn_locationname = LocationName;
         var ft = SupportFragmentManager.BeginTransaction ();
         ft.Replace (Resource.Id.home_content_framelayout, fragment);
         ft.AddToBackStack (null);
         ft.CommitAllowingStateLoss ();
         currentfragment = (global::Android.Support.V4.App.Fragment)fragment;
     }
 }