/// <summary> /// Initializes the viewing. /// </summary> /// <param name="peopleProfile">The people profile.</param> /// <param name="defNavToPivotIndex">Index of the def nav to pivot.</param> public void InitializeViewing(PeopleProfile peopleProfile, int defNavToPivotIndex = 0) { this._defaultPivotIndex = defNavToPivotIndex; this.Current = peopleProfile; base.DataContext = this; var name = string.Empty; if (this.Current != null) { name = peopleProfile.Name; } this.AllHeOwnMeBlockTitle.Text = AppResources.AllHeOwnMeBlockTitleFormatter.FormatWith(name); this.AllIOwnHimBlockTitle.Text = AppResources.AllIOwnHimBlockTitleFormatter.FormatWith(name); }
/// <summary> /// Initializes the edit object. /// </summary> /// <param name="peopleProfile">The people profile.</param> public void InitializeEditObject(PeopleProfile peopleProfile, bool isAdding = true) { CurrentObject = peopleProfile; isAdding = currentObject.Id == Guid.Empty; PageAction = PageActionType.Add; ControlActionTitle = AppResources.AddPerson.ToUpperInvariant(); if (!isAdding) { PageAction = PageActionType.Edit; ControlActionTitle = AppResources.EditPerson.ToUpperInvariant(); } }
public void LoadPeopleListFromPhoneContacts() { Contacts contacts = new Contacts(); contacts.SearchCompleted += delegate(object o, ContactsSearchEventArgs e) { System.Action a = null; if (e.Results != null) { int key = 0; System.Collections.Generic.Dictionary<Int32, PeopleProfile> resultToShow = new System.Collections.Generic.Dictionary<int, PeopleProfile>(); foreach (Contact contact in e.Results) { PeopleProfile profile2 = new PeopleProfile { Name = contact.DisplayName, Notes = contact.Notes.FirstOrDefault<string>() }; PeopleProfile profile = profile2; if (contact.CompleteName != null) { profile.FirstName = contact.CompleteName.FirstName; profile.LastName = contact.CompleteName.LastName; } if (contact.PhoneNumbers.Count<ContactPhoneNumber>() > 0) { ContactPhoneNumber number = contact.PhoneNumbers.FirstOrDefault<ContactPhoneNumber>(x => x.Kind == PhoneNumberKind.Mobile); profile.Telephone = (number == null) ? string.Empty : number.PhoneNumber; } if (contact.Addresses.Count<ContactAddress>() > 0) { ContactAddress address = contact.Addresses.FirstOrDefault<ContactAddress>(x => x.Kind == AddressKind.Home); profile.HomeAddress = ((address == null) || (address.PhysicalAddress == null)) ? string.Empty : address.PhysicalAddress.ToString(); } if (contact.EmailAddresses.Count<ContactEmailAddress>() > 0) { ContactEmailAddress address2 = contact.EmailAddresses.FirstOrDefault<ContactEmailAddress>(x => x.Kind == EmailAddressKind.Personal); profile.PersonalEmail = (address2 == null) ? string.Empty : address2.EmailAddress; } key++; resultToShow.Add(key, profile); } AllPeople.AllPeopleGetter = () => resultToShow; AllPeople.Current.HasLoaded = true; if (a == null) { a = delegate { this.PeopleList = new PeopleByFirstName(); base.DataContext = this; this.WorkDone(); }; } base.Dispatcher.BeginInvoke(a); } }; contacts.SearchAsync(string.Empty, FilterKind.None, null); }
public static string GetFirstNameKey(PeopleProfile person) { char c = '#'; if (person != null) { c = string.IsNullOrEmpty(person.name) ? '#' : person.name[0]; c = char.ToLower(c, LocalizedObjectHelper.CultureInfoCurrentUsed); } if ((c < 'a') || (c > 'z')) { c = GetFirstLetterFromChinese(person.name).ToLowerInvariant()[0]; if ((c < 'a') || (c > 'z')) { c = '#'; } } return c.ToString(); }
private void LoadPeopleInfo(System.Guid id) { this.BusyForWork(AppResources.NowLoadingFormatter.FormatWith(new object[] { AppResources.Profile.ToLowerInvariant() })); System.Threading.ThreadPool.QueueUserWorkItem(delegate(object o) { System.Action a = null; PeopleProfile item = ViewModelLocator.PeopleViewModel.AccountBookDataContext.Peoples.FirstOrDefault<PeopleProfile>(p => p.Id == id); if (item == null) { if (a == null) { a = delegate { this.ContentPanel.Children.Clear(); TextBlock block = new TextBlock { Text = AppResources.NotAvaliableObjectMessage.FormatWith(new object[] { AppResources.Profile.ToLowerInvariant() }) }; this.ContentPanel.Children.Add(block); }; } this.Dispatcher.BeginInvoke(a); } else { this.Dispatcher.BeginInvoke(delegate { this.current = item; this.peopleProfileViewer.InitializeViewing(this.current); this.ContentPanel.Children.Clear(); this.ContentPanel.Children.Add(this.peopleProfileViewer); this.WorkDone(); }); } }); }
public void InitializeViewing(PeopleProfile peopleProfile) { this.Current = peopleProfile; base.DataContext = this; }
private void detach_ToDo(PeopleProfile accountItem) { this.OnNotifyPropertyChanging("AccountItem"); accountItem.AssociatedGroup = null; }