public GalleryPage() { InitializeComponent(); ViewModel = GalleryPageViewModel.Instance; BindingContext = ViewModel; }
private static async Task AddFileToGalleryAsync(GalleryPageViewModel vm, StorageFile file, StorageFolder folder) { var mediaFile = await file.CopyAsync(folder, file.Name, NameCollisionOption.GenerateUniqueName); // Add new media file to gallery. //await vm.Gallery.AddFileAsync(vm.TileSize, mediaFile); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (_photoResult != null) { Model.OriginalImage = _photoResult.ChosenPhoto; Model.Saved = false; _photoResult = null; NavigationService.Navigate(new Uri("/Pages/SegmenterPage.xaml", UriKind.Relative)); } else { if (_viewModel == null) { _viewModel = new GalleryPageViewModel(); await _viewModel.Initialize(); DataContext = _viewModel; } Model.AnnotationsBitmap = null; Model.KernelShape = Lumia.Imaging.Adjustments.LensBlurPredefinedKernelShape.Circle; Model.KernelSize = 0.0; Model.OriginalImage = null; Model.Saved = false; } }
public ActionResult GalleryPage() { var images = _galleryRepo.GetAll(); var videos = _galleryVideosRepo.GetAll(); var vm = new GalleryPageViewModel() { Images = images, Videos = videos }; return(View(vm)); }
// GET: Admin/ArtGallery public ActionResult Index(int?page, string filter) { SearchPaginationViewModel search_vm = new SearchPaginationViewModel() { filter = filter + "", page = page.HasValue ? page.Value : 1 }; GalleryPageViewModel page_vm = NegahenoService.Get_Index_ArtGallery(search_vm, this); if (Request.IsAjaxRequest()) { return(PartialView("_PartialGalleryList", page_vm.paged_list_artGallery)); } else { return(View(page_vm)); } }
// Gallery public ActionResult Gallery(int pageIndex = 1, int?category = null) { int pageSize = 9; int totalRecords = 0; int totalFilteredRecords = 0; List <Album> albums = DataProvider .GetAlbums <Album> ( out totalRecords, out totalFilteredRecords, new DbParameters <Album> { PageSize = pageSize, PageIndex = pageIndex, Filters = category != null ? new Album { CategoryId = (int)category } : null }, true ) .Where(x => x.Photos != null && x.Photos.Count > 0) .ToList(); foreach (var album in albums) { album.Photos = album.Photos.OrderBy(p => p.UploadedOn).Take(1).ToList(); album.Photos.ForEach(photo => photo.FileUrl = photo.FileUrl != null ? System.IO.Path.Combine(GetImagesFolderPath("Photos"), photo.FileUrl) : null); } GalleryPageViewModel model = new GalleryPageViewModel { Albums = albums, PageCount = (totalFilteredRecords > pageSize ? (int)Math.Ceiling((decimal)totalFilteredRecords / pageSize) : 1), PageInex = pageIndex, CategoryId = category }; return(View(model)); }
public GalleryPageViewModel Get_Index_ArtGallery(SearchPaginationViewModel search_pagination_vm, Controller ctrl) { ctrl.TempData["page"] = search_pagination_vm.page; ctrl.TempData["filter"] = search_pagination_vm.filter; GalleryPageViewModel page_vm = new GalleryPageViewModel(); IPagedList <ArtGalleryViewModel> paged_list_artGallery = null; List <ArtGalleryViewModel> lst_gallery = DataLayer.Get_ArtGalleryList(); if (lst_gallery != null) { lst_gallery = FilterGalleryList(lst_gallery, search_pagination_vm.filter); lst_gallery = lst_gallery.OrderBy(x => x.fromDate).Select((x, Index) => new ArtGalleryViewModel() { rowNumber = Index + 1, GalleryId = x.GalleryId, fa_title = x.fa_title, description = x.description, fromDate = x.fromDate, toDate = x.toDate, fromHour = x.fromHour, toHour = x.toHour }).ToList(); int currentpage = search_pagination_vm.page.HasValue ? search_pagination_vm.page.Value : 1; paged_list_artGallery = lst_gallery.ToPagedList(currentpage, pagesize); } page_vm.paged_list_artGallery = paged_list_artGallery; page_vm.search_pagination_params = search_pagination_vm; return(page_vm); }
private static async Task CopyLocalFile(GalleryPageViewModel vm, StorageFile file) { var folder = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync("gallery"); await AddFileToGalleryAsync(vm, file, folder); }
public GalleryPage() { InitializeComponent(); BindingContext = _ViewModel = new GalleryPageViewModel(); }
protected override void OnNavigatedFrom(NavigationEventArgs e) { base.OnNavigatedFrom(e); DataContext = null; _viewModel = null; }