コード例 #1
0
 public override void ViewAppearing()
 {
     base.ViewAppearing();
     _topNavigationViewModelService.Show(new TopNavigationViewModel.PrepareModel()
     {
         Title             = "Library",
         ActionIconType    = Enums.TopNavigationViewIconType.Preferences,
         ActionIconCommand = new MvxCommand <string>(async(query) => await _navigationService.Navigate <PreferencesViewModel>())
     });
     _bottomNavigationViewModelService.CheckItem(Enums.BottomNavigationViewCheckedItemType.Library);
 }
コード例 #2
0
 public override void ViewAppeared()
 {
     base.ViewAppeared();
     _topNavigationViewModelService.Show(new TopNavigationViewModel.PrepareModel()
     {
         Title           = "Preferences",
         HomeIconType    = Enums.TopNavigationViewIconType.Back,
         HomeIconCommand = new MvxCommand(async() => await _navigationService.Close(this))
     }
                                         );
     _bottomNavigationViewModelService.CheckItem(Enums.BottomNavigationViewCheckedItemType.None);
 }
コード例 #3
0
 public override void ViewAppearing()
 {
     base.ViewAppearing();
     _topNavigationViewModelService.Show(new TopNavigationViewModel.PrepareModel()
     {
         Title             = (string.IsNullOrWhiteSpace(Id.Value) ? "Add" : "Update") + " song",
         HomeIconType      = Enums.TopNavigationViewIconType.Back,
         HomeIconCommand   = new MvxCommand(async() => await _navigationService.Close(this)),
         ActionIconType    = Enums.TopNavigationViewIconType.Done,
         ActionIconCommand = new MvxCommand <string>((query) => ChangeCommand.Execute(null)),
     }
                                         );
     _bottomNavigationViewModelService.CheckItem(Enums.BottomNavigationViewCheckedItemType.None);
 }
コード例 #4
0
        public override void ViewAppearing()
        {
            base.ViewAppearing();
            _topNavigationViewModelService.Show(new TopNavigationViewModel.PrepareModel()
            {
                Title             = "Search",
                ActionIconType    = Enums.TopNavigationViewIconType.Search,
                IsSearch          = true,
                ActionIconCommand = new MvxCommand <string>(_ =>
                {
                    if (SearchQuery.Value != _)
                    {
                        SearchQuery.Value = _;
                        if (!string.IsNullOrWhiteSpace(_))
                        {
                            Task.Run(async() =>
                            {
                                var songsResult = await _songService.GetMany(SearchQuery.Value, 0, 5);
                                if (songsResult.Success && SearchQuery.Value == _)
                                {
                                    Songs.Value = new ObservableCollection <SongViewModel>(songsResult.Result?.Select(s => new SongViewModel(s)));
                                }
                            });

                            Task.Run(async() =>
                            {
                                var artistsResult = await _artistService.GetMany(SearchQuery.Value, 0, 5);
                                if (artistsResult.Success && SearchQuery.Value == _)
                                {
                                    Artists.Value = new ObservableCollection <ArtistViewModel>(artistsResult.Result?.Select(a => new ArtistViewModel(a)));
                                }
                            });

                            Task.Run(async() =>
                            {
                                var albumsResult = await _albumService.GetMany(SearchQuery.Value, 0, 5);
                                if (albumsResult.Success && SearchQuery.Value == _)
                                {
                                    Albums.Value = new ObservableCollection <AlbumViewModel>(albumsResult.Result?.Select(a => new AlbumViewModel(a)));
                                }
                            });

                            Task.Run(async() =>
                            {
                                var playlistsResult = await _playlistService.GetMany(SearchQuery.Value, 0, 5);
                                if (playlistsResult.Success && SearchQuery.Value == _)
                                {
                                    Playlists.Value = new ObservableCollection <PlaylistViewModel>(playlistsResult.Result?.Select(p => new PlaylistViewModel(p)));
                                }
                            });
                        }
                        else
                        {
                            Songs.Value     = new ObservableCollection <SongViewModel>();
                            Artists.Value   = new ObservableCollection <ArtistViewModel>();
                            Albums.Value    = new ObservableCollection <AlbumViewModel>();
                            Playlists.Value = new ObservableCollection <PlaylistViewModel>();
                        }
                    }
                }),
                SearchQuery = SearchQuery.Value
            });
            _bottomNavigationViewModelService.CheckItem(Enums.BottomNavigationViewCheckedItemType.Search);
        }