Esempio n. 1
0
        public ProjectsPage()
        {
            this.InitializeComponent();

            ObservableCollection <GroupedList> groups = new ObservableCollection <GroupedList>();

            var query = from project in App.Client.Projects.Values
                        orderby project.Name
                        group project by char.ToUpper(project.Name[0]) into g
                        orderby g.Key
                        select new { GroupName = g.Key, Items = g };

            foreach (var g in query)
            {
                GroupedList group = new GroupedList()
                {
                    Key = g.GroupName
                };

                foreach (Project issue in g.Items)
                {
                    group.Add(issue);
                }
                groups.Add(group);
            }

            ProjectsList.Source = groups;
        }
Esempio n. 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Filter = e.Parameter as IssuesFilter;

            if (Filter != null)
            {
                if (Filter.Project != null)
                {
                    FilterDescription = $"Showing issues for project {Filter.Project.Name}:";
                }
                else if (Filter.Query != null)
                {
                    FilterDescription = $"Showing issues for query {Filter.Query.Name}:";
                }
                else if (Filter.User != null)
                {
                    FilterDescription = $"Showing issues assigned to {Filter.User.Name}:";
                }
            }
            else
            {
                FilterDescription = "Showing all issues:";

                ObservableCollection <GroupedList> groups = new ObservableCollection <GroupedList>();

                var query = from issue in App.Client.Issues.Values
                            group issue by issue.Subject[0] into g
                            orderby g.Key
                            select new { GroupName = g.Key, Items = g };

                foreach (var g in query)
                {
                    GroupedList group = new GroupedList()
                    {
                        Key = g.GroupName
                    };

                    foreach (Issue issue in g.Items)
                    {
                        group.Add(issue);
                    }
                    groups.Add(group);
                }

                IssuesList.Source = groups;
            }
        }