예제 #1
0
        public MyMusicViewModel(IEventAggregator eventAggregatorInstance, IMessagingService messagingServiceInstance, IShellViewModel shellViewModelInstance) : base(eventAggregatorInstance, messagingServiceInstance, shellViewModelInstance)
        {
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Artist".GetLocalized()), new ParameterOverride("symbol", "\uED53"), new ParameterOverride("startId", "0/My Music/Artists"), new ParameterOverride("searchId", "0/My Music/Search/TrackArtists")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Album".GetLocalized()), new ParameterOverride("symbol", "\uE958"), new ParameterOverride("startId", "0/My Music/Albums"), new ParameterOverride("searchId", "0/My Music/Search/Albums")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Genre".GetLocalized()), new ParameterOverride("symbol", "\uE74C"), new ParameterOverride("startId", "0/My Music/Genres"), new ParameterOverride("searchId", "")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Composer".GetLocalized()), new ParameterOverride("symbol", "\uE13D"), new ParameterOverride("startId", "0/My Music/Composers"), new ParameterOverride("searchId", "0/My Music/Search/Composers")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Folder".GetLocalized()), new ParameterOverride("symbol", "\uED43"), new ParameterOverride("startId", "0/My Music/ByFolder"), new ParameterOverride("searchId", "")
            }));

            InitializeCommand.Execute(null);
        }
예제 #2
0
        private async Task PerformSearch(string param)
        {
            SearchPhrase = param ?? "";
            var allItems = ((param ?? "") == "") ? new List <Product>() : (await DataManager.ProductDataSource.SearchProductsAsync(param));

            if (allItems?.Any() ?? false)
            {
                PivotItems.Clear();
                PivotItems.Add(new SearchGroupDisplayItem("", "All", allItems, true, ItemClickedCommand));
                SelectedPivot = PivotItems[0];
                foreach (string categoryId in allItems.Select(item => item.Category).Distinct())
                {
                    string categoryName = await DataManager.CategoryDataSource.GetCategoryNameAsync(categoryId);

                    PivotItems.Add(new SearchGroupDisplayItem(categoryId, categoryName, allItems.Where(item => item.Category == categoryId).ToList(), false, ItemClickedCommand));
                }
            }
            else
            {
                PivotItems.Clear();
                SelectedPivot = null;
            }
            IsInitializing = false;
            OnPropertyChanged("IsInitializing");
            OnPropertyChanged("PivotItems");
            OnPropertyChanged("PageName");
            OnPropertyChanged("HasResults");
            OnPropertyChanged("SearchPhrase");
            OnPropertyChanged("NoResultsText");
            OnPropertyChanged("SearchPhrase");
        }
예제 #3
0
        public async Task LoadSubreddits()
        {
            var subreddits = await _offlineService.RetrieveOrderedThings("pivotsubreddits");

            PivotItems.Add(new SubredditSelectorViewModel(_baconProvider));

            if (subreddits == null || subreddits.Count() == 0)
            {
                subreddits = new List <TypedThing <Subreddit> > {
                    new TypedThing <Subreddit>(SubredditInfo.GetFrontPageThing())
                }
            }
            ;

            foreach (var sub in subreddits)
            {
                if (sub.Data is Subreddit && ((Subreddit)sub.Data).Id != null)
                {
                    var message = new SelectSubredditMessage();
                    message.Subreddit = new TypedThing <Subreddit>(sub);
                    ChangeSubreddit(message, false);
                }
            }

            Messenger.Default.Send <SelectIndexMessage>(
                new SelectIndexMessage
            {
                TypeContext = typeof(MainPageViewModel),
                Index       = 0
            }
                );
        }
예제 #4
0
        public TuneInViewModel(IEventAggregator eventAggregatorInstance, IMessagingService messagingServiceInstance, IShellViewModel shellViewModelInstance) : base(eventAggregatorInstance, messagingServiceInstance, shellViewModelInstance)
        {
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Favorites".GetLocalized()), new ParameterOverride("symbol", "\uEB51"), new ParameterOverride("startId", "0/RadioTime/Favorites"), new ParameterOverride("searchId", "0/RadioTime/Search")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "RadioLocal".GetLocalized()), new ParameterOverride("symbol", "\uE80F"), new ParameterOverride("startId", "0/RadioTime/LocalRadio"), new ParameterOverride("searchId", "0/RadioTime/Search")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "RadioMusic".GetLocalized()), new ParameterOverride("symbol", "\uE189"), new ParameterOverride("startId", "0/RadioTime/CategoryMusic"), new ParameterOverride("searchId", "0/RadioTime/Search")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "RadioTalk".GetLocalized()), new ParameterOverride("symbol", "\uE125"), new ParameterOverride("startId", "0/RadioTime/CategoryTalk"), new ParameterOverride("searchId", "0/RadioTime/Search")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "RadioSport".GetLocalized()), new ParameterOverride("symbol", "\uE805"), new ParameterOverride("startId", "0/RadioTime/CategorySports"), new ParameterOverride("searchId", "0/RadioTime/Search")
            }));

            InitializeCommand.Execute(null);
        }
예제 #5
0
        public FavoritesViewModel(IEventAggregator eventAggregatorInstance, IMessagingService messagingServiceInstance, IShellViewModel shellViewModelInstance) : base(eventAggregatorInstance, messagingServiceInstance, shellViewModelInstance)
        {
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "MyFavorites".GetLocalized()), new ParameterOverride("symbol", "\uEB51"), new ParameterOverride("startId", "0/Favorites/MyFavorites"), new ParameterOverride("searchId", "")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "RecentlyPlayed".GetLocalized()), new ParameterOverride("symbol", "\uE823"), new ParameterOverride("startId", "0/Favorites/RecentlyPlayed"), new ParameterOverride("searchId", "")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "MostPlayed".GetLocalized()), new ParameterOverride("symbol", "\uE8D6"), new ParameterOverride("startId", "0/Favorites/MostPlayed"), new ParameterOverride("searchId", "")
            }));

            InitializeCommand.Execute(null);
        }
예제 #6
0
        public PlaylistsViewModel(IEventAggregator eventAggregatorInstance, IMessagingService messagingServiceInstance, IShellViewModel shellViewModelInstance) : base(eventAggregatorInstance, messagingServiceInstance, shellViewModelInstance)
        {
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "MyPlaylists".GetLocalized()), new ParameterOverride("symbol", "\uE90B"), new ParameterOverride("startId", "0/Playlists/MyPlaylists"), new ParameterOverride("searchId", "")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Shuffles".GetLocalized()), new ParameterOverride("symbol", "\uE14B"), new ParameterOverride("startId", "0/Playlists/Shuffles"), new ParameterOverride("searchId", "")
            }));
            PivotItems.Add(PrismUnityApplication.Current.Container.Resolve <PivotItemViewModel>(new ResolverOverride[]
            {
                new ParameterOverride("label", "Imported".GetLocalized()), new ParameterOverride("symbol", "\uE118"), new ParameterOverride("startId", "0/Playlists/Imported"), new ParameterOverride("searchId", "")
            }));

            InitializeCommand.Execute(null);
        }
예제 #7
0
        public void loadNext()
        {
            if (PivotItems.Count == 0)
            {
                PivotItems.Add(SigfoodApiService.getDataOfDate());

                selectedDay = PivotItems.First();
            }

            while (PivotItems.Count - PivotItems.IndexOf(selectedDay) - 1 < 3 && PivotItems.Last().nextDate != null)
            {
                PivotItems.Add(SigfoodApiService.getDataOfDate(PivotItems.Last().nextDate));
            }
            while (PivotItems.IndexOf(selectedDay) < 3 && PivotItems.First().prevDate != null)
            {
                PivotItems.Insert(0, SigfoodApiService.getDataOfDate(PivotItems.First().prevDate));
            }
        }
예제 #8
0
        private void OnSelectTemporarySubreddit(SelectTemporaryRedditMessage message)
        {
            int  indexToPosition;
            bool foundExisting = FindSubredditMessageIndex(message, out indexToPosition);

            if (!foundExisting)
            {
                var newReddit = new TemporaryRedditViewModel(_baconProvider);
                newReddit.RedditViewModel.DetachSubredditMessage();
                newReddit.RedditViewModel.AssignSubreddit(message);
                if (PivotItems.Count > 0)
                {
                    PivotItems.Insert(PivotItems.Count - 1, newReddit);
                }
                else
                {
                    PivotItems.Add(newReddit);
                }
                indexToPosition = PivotItems.Count - 1;
            }
        }
예제 #9
0
        private void ChangeSubreddit(SelectSubredditMessage message, bool fireSubredditsChanged = true)
        {
            int  indexToPosition;
            bool foundExisting = FindSubredditMessageIndex(message, out indexToPosition);

            if (!foundExisting)
            {
                var newReddit = new RedditViewModel(_baconProvider);
                newReddit.DetachSubredditMessage();
                newReddit.AssignSubreddit(message);
                if (PivotItems.Count > 0)
                {
                    PivotItems.Insert(PivotItems.Count - 1, newReddit);
                }
                else
                {
                    PivotItems.Add(newReddit);
                }
                _subreddits.Add(message.Subreddit);
                RaisePropertyChanged("PivotItems");
                indexToPosition = PivotItems.Count - 2;
            }

            if (fireSubredditsChanged)
            {
                RaisePropertyChanged("Subreddits");

                Messenger.Default.Send <SelectIndexMessage>(
                    new SelectIndexMessage
                {
                    TypeContext = typeof(MainPageViewModel),
                    Index       = indexToPosition
                }
                    );
            }
        }
예제 #10
0
 private async Task AddPivot(int i)
 {
     PivotItems.Add(new BudgetItemViewModel(_current.AddMonths(-i), await GetModel(-i)));
 }