private void FillEntriesList(SidebarListItem selectedGroup) { GroupModel group = selectedGroup.DataObject as GroupModel; IList <EntryModel> entries = databaseCommands.FindEntries(group).OrderBy(x => x.Title).ToList(); EntriesTableView.DataSource = new EntriesDataSource(entries); for (int index = 0; index < configuration.AvailableColumns.Count; index++) { EntryColumn c = configuration.AvailableColumns[index]; NSTableColumn[] columns = EntriesTableView.TableColumns(); NSTableColumn col = columns[index]; col.HeaderCell.StringValue = c.Header; } }
private void FillGroupsRecursive(SidebarListItem addTo, GroupModel parent) { if (parent.Childs.Count == 0) { return; } foreach (GroupModel child in parent.Childs) { SidebarListItem item = new SidebarListItem(child.Name); item.DataObject = child; FillGroupsRecursive(item, child); addTo.Children.Add(item); } }
private void FillGroups(TreeGroupModel tree) { List <SidebarListItem> roots = new List <SidebarListItem> (); foreach (GroupModel group in tree.Nodes) { SidebarListItem rootItem = new SidebarListItem(group.Name); rootItem.DataObject = group; rootItem.IsHeader = true; rootItem.Expandable = true; FillGroupsRecursive(rootItem, group); roots.Add(rootItem); } GroupsSourceList.DataSource = new SidebarDataSource(roots); // expand the 1st item and all childs GroupsSourceList.ExpandItem(GroupsSourceList.ItemAtRow(0), true); }