Ejemplo n.º 1
0
        private void CreateData()
        {
            if (this._groupData == null)
            {
                return;
            }
            Group group = this._groupData.group;

            if (!string.IsNullOrEmpty(this._groupData.Activity) || this._groupData.AdminLevel > 1)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem()
                {
                    Items = new List <ProfileInfoItem>()
                    {
                        (ProfileInfoItem) new StatusItem((IProfileData)this._groupData)
                    }
                });
            }
            List <ProfileInfoItem> profileInfoItemList1 = new List <ProfileInfoItem>();

            if (!string.IsNullOrEmpty(group.description))
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_Description, group.description, null, ProfileInfoItemType.RichText));
            }
            if (group.start_date > 0 && group.GroupType == GroupType.Event)
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_StartDate, UIStringFormatterHelper.FormatDateTimeForUI(group.start_date), (Action)(() => this.CreateAppointment(group.start_date, group.finish_date, group.name, group.place != null ? group.place.address : "")), ProfileInfoItemType.RichText));
            }
            if (group.finish_date > 0)
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_FinishDate, UIStringFormatterHelper.FormatDateTimeForUI(group.finish_date), (Action)(() => this.CreateAppointment(group.start_date, group.finish_date, group.name, group.place != null ? group.place.address : "")), ProfileInfoItemType.RichText));
            }
            string description = "";

            if (group.place != null && !string.IsNullOrEmpty(group.place.address))
            {
                description = group.place.address;
            }
            if (group.city != null && !string.IsNullOrEmpty(group.city.title))
            {
                if (!string.IsNullOrEmpty(description))
                {
                    description += ", ";
                }
                description += group.city.title;
            }
            if (group.country != null && !string.IsNullOrEmpty(group.country.title))
            {
                if (!string.IsNullOrEmpty(description))
                {
                    description += ", ";
                }
                description += group.country.title;
            }
            if (!string.IsNullOrEmpty(description))
            {
                Action navigationAction = null;
                if (group.place != null && group.place.latitude != 0.0 && group.place.longitude != 0.0)
                {
                    navigationAction = (Action)(() => Navigator.Current.NavigateToMap(false, group.place.latitude, group.place.longitude));
                }
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_Location.ToLowerInvariant(), description, navigationAction, ProfileInfoItemType.RichText));
            }
            if (profileInfoItemList1.Count > 0)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem()
                {
                    Items = profileInfoItemList1
                });
            }
            List <ProfileInfoItem> profileInfoItemList2 = new List <ProfileInfoItem>()
            {
                (ProfileInfoItem) new VKSocialNetworkItem((IProfileData)this._groupData)
            };

            if (!string.IsNullOrEmpty(group.site))
            {
                profileInfoItemList2.Add((ProfileInfoItem) new SiteItem(group.site));
            }
            if (profileInfoItemList2.Count > 0)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_ContactInformation)
                {
                    Items = profileInfoItemList2
                });
            }
            List <ProfileInfoItem> profileInfoItemList3 = new List <ProfileInfoItem>();

            if (!group.links.IsNullOrEmpty())
            {
                profileInfoItemList3.AddRange((IEnumerable <ProfileInfoItem>)LinkItem.GetLinkItems(group.links));
                if (profileInfoItemList3.Count > 0)
                {
                    this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_Links)
                    {
                        Items = profileInfoItemList3
                    });
                }
            }
            List <ProfileInfoItem> profileInfoItemList4 = new List <ProfileInfoItem>();

            if (!group.contacts.IsNullOrEmpty())
            {
                profileInfoItemList4.AddRange((IEnumerable <ProfileInfoItem>)ContactItem.GetContactItems(group.contacts, this._groupData.contactsUsers));
                if (profileInfoItemList4.Count > 0)
                {
                    this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_Contacts)
                    {
                        Items = profileInfoItemList4
                    });
                }
            }
            if (this.InfoSections.Count <= 0)
            {
                return;
            }
            this.InfoSections.Last <ProfileInfoSectionItem>().DividerVisibility = Visibility.Collapsed;
        }