コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainViewModel()
        {
            _dataSource = new SampleDataSource();

            // Commands
            ShowItemDetails  = new DelegateCommand <SampleDataItemViewModel>(OnShowItemDetails, it => it != null);
            ShowGroupDetails = new DelegateCommand <SampleDataGroupViewModel>(OnShowGroupDetails, it => it != null);
            SortByName       = new DelegateCommand(OnSortGroupsByName);

            SelectedItem  = AllGroups[0].Items[0];
            SelectedGroup = AllGroups[0];
        }
コード例 #2
0
        public void OnNavigatedTo(NavigatedToEventArgs e)
        {
            var state = e.State;

            if (state != null)
            {
                object id;
                if (state.TryGetValue("SelectedItem", out id) && id != null)
                {
                    SelectedItem = GetItem(id.ToString());
                }
                if (state.TryGetValue("SelectedGroup", out id) && id != null)
                {
                    SelectedGroup = GetGroup(id.ToString());
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Display the item details
 /// </summary>
 /// <param name="item"></param>
 private void OnShowItemDetails(SampleDataItemViewModel item)
 {
     SelectedItem  = item;
     SelectedGroup = item.Group;
     Resolve <IPageNavigator>().NavigateTo("ItemDetailsPage");
 }
コード例 #4
0
 /// <summary>
 /// Display the group details
 /// </summary>
 /// <param name="group"></param>
 private void OnShowGroupDetails(SampleDataGroupViewModel group)
 {
     SelectedGroup = group;
     SelectedItem  = group.Items.FirstOrDefault();
     Resolve <IPageNavigator>().NavigateTo("GroupDetailsPage");
 }