コード例 #1
0
        public FavoriteListPage()
        {
            Title = "Favorite";
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext = favViewModel = new FavoriteListViewModel(this);
            // favViewModel.GetFavoriteListCommand.Execute(null);
            var searchBar = new SearchBar
            {
                Placeholder       = "Search Favorite ",
                BackgroundColor   = Color.White,
                CancelButtonColor = App.BrandColor,
            };


            var favlist = new ListView
            {
                HasUnevenRows   = false,
                ItemTemplate    = new DataTemplate(typeof(CPFavList)),
                ItemsSource     = favViewModel.FavList,
                BackgroundColor = Color.White,
                RowHeight       = 80,
            };

            searchBar.TextChanged         += (sender, e) => FilterLocations(favlist, searchBar.Text);
            searchBar.SearchButtonPressed += (sender, e) =>
            {
                FilterLocations(favlist, searchBar.Text);
            };
            //favlist.SetBinding(ListView.ItemsSourceProperty, "favlist");
            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.White,
                Children          = { searchBar, favlist }
            };

            favlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var favPage = new WebViewPage(selectedObject.title, selectedObject.websiteLink.HttpUrlFix());
                Navigation.PushAsync(favPage);
            };



            //MessagingCenter.Subscribe(this, "DeleteThis", async (string id) =>
            //{
            //    if (String.IsNullOrEmpty(id)) return;
            //    favViewModel.GetFavoriteListCommand.Execute(null);
            //});
            // favlist.SetBinding(MenuItem.CommandProperty, favViewModel.DeleteItemCommand);
        }
コード例 #2
0
        // CRUD OPERATONS ON FAVORITES


        // GET: Favorites
        public async Task <IActionResult> Index()
        {
            var viewModel = new FavoriteListViewModel();
            var user      = await GetCurrentUserAsync();

            viewModel.Favorites = await _context.Favorite.Include(f => f.Sample).ToListAsync();

            viewModel.Samples = await _context.Sample.Where(s => s.ApplicationUserId == user.Id).ToListAsync();

            return(View(viewModel));
        }
コード例 #3
0
        public IViewComponentResult Invoke()
        {
            var items = _favoriteList.GetFavoriteListItems();

            _favoriteList.FavoriteListItems = items;

            var favoriteListViewModel = new FavoriteListViewModel
            {
                FavoriteService = _favoriteList,
            };

            return(View(favoriteListViewModel));
        }
コード例 #4
0
        public ViewResult Index()
        {
            var items = _favoriteService.GetFavoriteListItems();

            _favoriteService.FavoriteListItems = items;

            var favoriteListViewModel = new FavoriteListViewModel
            {
                FavoriteService = _favoriteService,
            };

            return(View(favoriteListViewModel));
        }
コード例 #5
0
        public async Task <IActionResult> Favorites()
        {
            var favorites = await _userManager.GetFavoritesAsync(HttpContext.User);

            FavoriteListViewModel favoriteListViewModels = new FavoriteListViewModel();

            if (favorites != null)
            {
                foreach (var favorite in favorites)
                {
                    var result = await _movieService.GetDetailsAsync(favorite.MovieId);

                    if (result.IsSuccessful)
                    {
                        favoriteListViewModels.FavoriteDetailViewModels.Add(_mapper.Map <FavoriteDetailViewModel>(result.Data));
                    }
                }
                var userId = _userManager.GetUserId(HttpContext.User);
                try
                {
                    using (CountWebServiceSoapClient client = new CountWebServiceSoapClient(CountWebServiceSoapClient.EndpointConfiguration.CountWebServiceSoap))
                    {
                        var response = await client.FavoriteCountAsync(userId);

                        favoriteListViewModels.Count = response.Body.FavoriteCountResult;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    return(RedirectToAction("ErrorWithModel", "Error", new ErrorViewModel {
                        MessageTitle = e.Message
                    }));
                }
            }
            return(View(favoriteListViewModels));
        }
コード例 #6
0
        public FavoriteListPage()
        {
            Title = "Gacetas Anteriores";
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext = favViewModel = new FavoriteListViewModel(this);
            // favViewModel.GetFavoriteListCommand.Execute(null);

            Gacetas.Add("Gaceta 5", "http://dticursos.pjedomex.gob.mx/fianzas/archivos/recibosUnicos/358833.pdf");

            Image logo = new Image
            {
                Source        = "icon.png",
                WidthRequest  = 500,
                HeightRequest = 150
            };

            Label tituloSec = new Label
            {
                Text              = "Seleccione gaceta a descargar",
                FontSize          = 18,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Picker picker = new Picker
            {
                Title           = "Gacetas UAQ",
                VerticalOptions = LayoutOptions.Center
            };

            foreach (string GacetaAnterior in Gacetas.Keys)
            {
                picker.Items.Add(GacetaAnterior);
            }

            picker.SelectedIndexChanged += (sender, e) =>
            {
                //var favPage = new WebViewPage(selectedObject.titulo, selectedObject.websiteLink.HttpUrlFix());
                if (picker.SelectedIndex == -1)
                {
                }
                else
                {
                    //string colorName = picker.Items[picker.SelectedIndex];
                    //boxView.Color = nameToColor[colorName];
                }
            };

            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.White,
                Children          = { logo, tituloSec, picker }
            };


            //MessagingCenter.Subscribe(this, "DeleteThis", async (string id) =>
            //{
            //    if (String.IsNullOrEmpty(id)) return;
            //    favViewModel.GetFavoriteListCommand.Execute(null);
            //});
            // favlist.SetBinding(MenuItem.CommandProperty, favViewModel.DeleteItemCommand);
        }