Esempio n. 1
0
 public UserDataPage()
 {
     InitializeComponent();
     photosCollectionControl.CellSelected += photosCollectionControl_CellSelected;
     AlbumsCollectionViewModel = new AlbumsViewModel();
     photosCollectionControl.Initialize(AlbumsCollectionViewModel);
     AlbumsCollectionViewModel.Initialize(cts.Token, false);
 }
 private void InitializeViewModels()
 {
     ViewModels = new ObservableCollection<ViewModel>();
     var albumsModel = new AlbumsViewModel();
     albumsModel.IsSelectionEnabled = false;
     albumsModel.Initialize(cts.Token);
     var contactsModel = new ContactsViewModel();
     contactsModel.IsSelectionEnabled = true;
     contactsModel.Initialize(cts.Token);
     ViewModels.Add(albumsModel);
     ViewModels.Add(contactsModel);
   
 }
 protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
 {
     if(ViewModels[pivot.SelectedIndex].IsSelectionEnabled == true)
     {
         e.Cancel = true;
         ViewModels[pivot.SelectedIndex].IsSelectionEnabled = false;
         pivot.IsLocked = true;
         CreateSelectionAppBar();
         return;
     }
     if (deep == 0)
         base.OnBackKeyPress(e);
     else
     {
         e.Cancel = true;
         deep--;
         if (pivot.SelectedIndex == 0)
         {
             ViewModels[0] = new AlbumsViewModel();
             ((pivot.SelectedItem as PivotItem).Content as CollectionControl).Initialize(ViewModels[0]);
         }
     }
 }