Exemplo n.º 1
0
        private void WireCommands()
        {
            PageLoaded = new RelayCommand(async() =>
            {
                if (_navigationService.IsNetworkAvailable && !_dataLoaded)
                {
                    SetProgressBar(AppResources.SysTrayGettingItems);

                    GroupBy     = App.SpecificSettings.DefaultGroupBy;
                    _dataLoaded = await GetItems();

                    SortList();

                    SetProgressBar();
                }
            });

            CollectionPageLoaded = new RelayCommand(async() =>
            {
                if (_navigationService.IsNetworkAvailable && !_dataLoaded && SelectedFolder != null)
                {
                    SetProgressBar(AppResources.SysTrayCheckingCollection);

                    var tileUrl = string.Format(Constants.PhoneTileUrlFormat, "Collection", SelectedFolder.Id, SelectedFolder.Name);

                    CanPinCollection = TileService.Current.TileExists(tileUrl);

                    _dataLoaded = await GetCollectionItems();

                    SetProgressBar();
                }

                if (!CurrentItems.IsNullOrEmpty())
                {
                    GetRandomItems();
                }
            });

            SeeMoreCommand = new RelayCommand(() =>
            {
                App.SelectedItem = SelectedFolder;
                _navigationService.NavigateTo("/Views/FolderView.xaml");
            });

            NavigateTo = new RelayCommand <BaseItemDto>(_navigationService.NavigateTo);
        }