Exemple #1
0
        private List <Grouping <string, AboutPageItem> > GetAboutItems()
        {
            var aboutPageItems = new List <Grouping <string, AboutPageItem> >();

            aboutPageItems.Add(new Grouping <string, AboutPageItem>("Friends", new AboutPageItem[] {
                new AboutPageItem
                {
                    AboutItemType = AboutItemType.Friends
                }
            }));

            var communities = RealmService.Get <CommunityModel>();
            var sessions    = RealmService.Get <MeetupModel>();
            var communitiesWithFirstSessionDate = communities.Join(
                sessions,
                c => c.Id,
                s => s.CommunityID,
                (c, s) => new
            {
                Community        = c,
                FirstSessionDate = s.Sessions.OrderBy(session => session.StartTime).FirstOrDefault()?.StartTime
            }).OrderBy(x => x.FirstSessionDate).GroupBy(x => x.Community.Id).Select(x => x.First());

            aboutPageItems.Add(new Grouping <string, AboutPageItem>("OurCommunities", communitiesWithFirstSessionDate.Select(x => new AboutPageItem
            {
                Community     = x.Community,
                AboutItemType = AboutItemType.Community
            })));

            var aboutAppItems = new Model.MenuItem[]
            {
                new Model.MenuItem {
                    Name = "CreatedBy", Parameter = "CreatedBy"
                },
                new Model.MenuItem {
                    Name = "IssueTracker", Parameter = "IssueTracker"
                },
                new Model.MenuItem {
                    Name = "TechnologyUsed", Parameter = "TechnologyUsed"
                },
            };

            aboutPageItems.Add(new Grouping <string, AboutPageItem>("AboutApp", aboutAppItems.Select(x => new AboutPageItem
            {
                MenuItem      = x,
                AboutItemType = AboutItemType.MenuItem
            })));

            aboutPageItems.Add(new Grouping <string, AboutPageItem>("Settings", new AboutPageItem[] {
                new AboutPageItem
                {
                    AboutItemType = AboutItemType.Settings
                }
            }));

            return(aboutPageItems);
        }
Exemple #2
0
 public static IList <SubscriptionModel> GetDefaultCommunitySubscriptionsByRealm(Realm realm)
 {
     return(DefaultCommunitySubscriptions.Union(RealmService.Get <CommunityModel>(realm).Select(x => new SubscriptionModel
     {
         Community = x,
         IsSelected = true,
         LoadedPosts = 100,
         Type = SocialMediaType.Vkontakte
     })).ToList());
 }
Exemple #3
0
        private List <Grouping <string, AboutPageItem> > GetAboutItems()
        {
            var aboutPageItems = new List <Grouping <string, AboutPageItem> >();

            aboutPageItems.Add(new Grouping <string, AboutPageItem>(nameof(AppResources.Friends), new [] {
                new AboutPageItem
                {
                    AboutItemType = AboutItemType.Friends
                }
            }));

            aboutPageItems.Add(new Grouping <string, AboutPageItem>(nameof(AppResources.Subscriptions), new[] {
                new AboutPageItem
                {
                    AboutItemType = AboutItemType.Subscriptions
                }
            }));

            var communities = RealmService.Get <CommunityModel>();
            var sessions    = RealmService.Get <MeetupModel>();
            var communitiesWithFirstSessionDate = communities.Join(
                sessions,
                c => c.Id,
                s => s.CommunityID,
                (c, s) => new
            {
                Community        = c,
                FirstSessionDate = s.Sessions.OrderBy(session => session.StartTime).FirstOrDefault()?.StartTime
            }).OrderBy(x => x.FirstSessionDate).GroupBy(x => x.Community.Id).Select(x => x.First());

            aboutPageItems.Add(new Grouping <string, AboutPageItem>(nameof(AppResources.OurCommunities), communitiesWithFirstSessionDate.Select(x => new AboutPageItem
            {
                Community     = x.Community,
                AboutItemType = AboutItemType.Community
            })));

            var aboutAppItems = new []
            {
                new Model.MenuItem {
                    Name = nameof(AppResources.CreatedBy), Parameter = nameof(AppResources.CreatedBy)
                },
                new Model.MenuItem {
                    Name = nameof(AppResources.IssueTracker), Parameter = nameof(AppResources.IssueTracker)
                },
                new Model.MenuItem {
                    Name = nameof(AppResources.TechnologyUsed), Parameter = nameof(AppResources.TechnologyUsed)
                },
            };

            aboutPageItems.Add(new Grouping <string, AboutPageItem>(nameof(AppResources.AboutApp), aboutAppItems.Select(x => new AboutPageItem
            {
                MenuItem      = x,
                AboutItemType = AboutItemType.MenuItem
            })));

            aboutPageItems.Add(new Grouping <string, AboutPageItem>(nameof(AppResources.Settings), new [] {
                new AboutPageItem
                {
                    AboutItemType = AboutItemType.Settings
                }
            }));

            return(aboutPageItems);
        }