Пример #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.Items        = new ObservableCollection <object>(PhotosDataSource.GetItems());
            this.ItemTemplate = Resources["Hero"] as DataTemplate;

            base.OnNavigatedTo(e);
        }
Пример #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var items = PhotosDataSource.GetItems();

            this.NatureItems  = new ObservableCollection <object>(items.Where(x => x.Category == "Nature"));
            this.AnimalItems  = new ObservableCollection <object>(items.Where(x => x.Category == "Animal"));
            this.CityItems    = new ObservableCollection <object>(items.Where(x => x.Category == "City"));
            this.MotorItems   = new ObservableCollection <object>(items.Where(x => x.Category == "Motor"));
            this.ItemTemplate = Resources["PhotoItemTemplate"] as DataTemplate;

            base.OnNavigatedTo(e);
        }
 private void LoadData()
 {
     try
     {
         ErrorVisibility = Visibility.Collapsed;
         this.Items      = new ObservableCollection <object>(PhotosDataSource.GetItems());
         if (ForceCrash)
         {
             throw new Exception("Simulate exception");
         }
     }
     catch (System.Exception)
     {
         ErrorVisibility = Visibility.Visible;
     }
 }
Пример #4
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.Items         = new ObservableCollection <PhotoDataItem>(PhotosDataSource.GetItems());
            this.MemoryItems   = new ObservableCollection <PhotoDataItem>();
            this.ItemsInMemory = MemoryItems.Count;
            var cacheData = await AppCache.GetItemsAsync <PhotoDataItem>("AppCacheSample");

            if (cacheData == null || cacheData.Items == null)
            {
                this.ItemsInCache = 0;
            }
            else
            {
                this.ItemsInCache = cacheData.Items.Count();
            }
            this.ItemTemplate = Resources["PhotoItemTemplate"] as DataTemplate;
            base.OnNavigatedTo(e);
        }
Пример #5
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
            ApplicationView.PreferredLaunchViewSize      = new Size {
                Width = 1056, Height = 790
            };
            await BitmapCache.ClearCacheAsync(TimeSpan.FromHours(24));

            await PhotosDataSource.Load();

            await FeaturedControlsDataSource.Load();

            var shell = Window.Current.Content as AppShell;

            if (shell == null)
            {
                shell = new AppShell()
                {
                    Language = Windows.Globalization.ApplicationLanguages.Languages[0]
                };
                NavigationService.Initialize(typeof(App), shell.AppFrame);
                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }

            Window.Current.Content = shell;

            if (shell.AppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page suppressing the initial entrance animation.
                shell.AppFrame.Navigate(typeof(MainPage), e.Arguments, new SuppressNavigationTransitionInfo());
            }

            Window.Current.Activate();
        }
Пример #6
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     this.Items        = new ObservableCollection <object>(PhotosDataSource.GetItems());
     this.SizeChanged += SizeChangedEvent;
     base.OnNavigatedTo(e);
 }
Пример #7
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Items = new ObservableCollection <object>(PhotosDataSource.GetGroupedItems());

            base.OnNavigatedTo(e);
        }
Пример #8
0
 public void Refresh()
 {
     this.Items = new ObservableCollection <object>(PhotosDataSource.GetItems());
 }