public PortalGroupViewModel()
{
Messenger.Default.Register<ChangeGroupSelectedMessage>(this,
msg => { PortalGroup = msg.Group; });
// initialize ListGroupContent RelayCommand
ListGroupContentCommand = new RelayCommand<ArcGISPortalGroup>(async pg =>
{
if (pg == null)
return;
var gsItems = await pg.GetItemsAsync();
if (gsItems == null || !gsItems.Any())
return;
// filter out any ArcGISPortalItem that is not a WebMap
var webMapItems = gsItems.Where(item => item.Type == ItemType.WebMap);
// create an observable collection of the WebMap items
var groupSharedItems = new ObservableCollection<ArcGISPortalItem>(webMapItems);
if (!groupSharedItems.Any())
return;
// send ChangePortalItemsCollectionMessage message to other ViewModels who are registered with it.
Messenger.Default.Send<ChangePortalItemsCollectionMessage>(new ChangePortalItemsCollectionMessage()
{
ItemCollection = groupSharedItems,
Title = string.Format("Content of Group: {0}", pg.Title)
});
// use the navigation service to navigate to the page showing the specific collection of portal items
(new NavigationService()).Navigate(App.CollectionPageName);
});
}