Example #1
0
 public LibraryCtrlViewModel(ImageListViewModel library)
 {
     _images = new List<ImageViewModel>();
     foreach (var i in library)
     {
         _images.Add(i);
     }
     _current = _images[1];
 }
Example #2
0
        public ActionResult List(int id, HomeIndexViewModel homeIndexViewModel)
        {
            var model = new ImageListViewModel {
                Images = _service.GetImages()
            };

            model.NavigationModel = homeIndexViewModel;
            return(View(model));
        }
        public ActionResult ImageList(string path)
        {
            ImageListViewModel Obj = new ImageListViewModel();

            Obj.path = path;
            ImageUploader imageClient = new ImageUploader(System.Web.Configuration.WebConfigurationManager.AppSettings["GoogleCloud:BucketName"]);

            Obj.ImageList = imageClient.ListOfObjects(path);
            return(View(Obj));
        }
Example #4
0
        public void CanSelectLastImage_FirstSelected_Allowed()
        {
            var selectedImage = new ImageViewModel();
            var viewModel     = new ImageListViewModel(Dispatcher.CurrentDispatcher)
            {
                SelectedImage       = selectedImage,
                ImageListCollection = { selectedImage, new ImageViewModel() }
            };

            Assert.IsTrue(Commands.SelectLastImageCommand.CanExecute(viewModel));
        }
Example #5
0
        public void CanClearImages_DefinedCollection_Checked(int imagesCount, bool canClear)
        {
            var viewModel = new ImageListViewModel(Dispatcher.CurrentDispatcher);

            foreach (var _ in Enumerable.Range(0, imagesCount))
            {
                viewModel.ImageListCollection.Add(new ImageViewModel());
            }

            Assert.AreEqual(canClear, Commands.ClearImageFilesCommand.CanExecute(viewModel));
        }
Example #6
0
        public void CanSelectLastImage_AlreadySelected_Denied()
        {
            var selectedImage = new ImageViewModel();
            var viewModel     = new ImageListViewModel(Dispatcher.CurrentDispatcher)
            {
                SelectedImage       = selectedImage,
                ImageListCollection = { new ImageViewModel(), selectedImage }
            };

            Assert.IsFalse(Commands.SelectLastImageCommand.CanExecute(viewModel));
        }
Example #7
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            var imageListViewModel = new ImageListViewModel(Dispatcher.CurrentDispatcher);

            imageListViewModel.InitializeCollection();

            var mainWindowViewModel = new MainWindowViewModel(imageListViewModel);

            DataContext = mainWindowViewModel;
        }
Example #8
0
        // Daten für die ViewModel-Elemente laden
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            coordinates = new List<GeoCoordinate>();
            var model = new ImageListViewModel();
            FlickrWrapper.GetInstance().AddObserver(delegate(ImageViewModel img) { model.AddImage(img); coordinates.Add(img.Position); AutoFocusMap(); });
            //FlickrWrapper.GetInstance().GetPhotos();
            LayoutRoot.DataContext = model;
            pictureMap.Mode = new RoadMode();

            // register shake event

            ShakeGesturesHelper.Instance.ShakeGesture += new EventHandler<ShakeGestureEventArgs>(shake_ShakeDetected);
            ShakeGesturesHelper.Instance.MinimumRequiredMovesForShake = 3;
            ShakeGesturesHelper.Instance.Active = true;
        }
        public async Task <IActionResult> AllowedImages()
        {
            var images = await _dataAccess.GetAllowedImages();

            var vm = new ImageListViewModel()
            {
                Images = images?.Select(x => new ImageListViewModel.Image()
                {
                    Id           = x.ImageId ?? 0,
                    Url          = _storageAccess.GetUrlForRelativePath(x.RelativePath),
                    ThumbnailUrl = string.IsNullOrWhiteSpace(x.ThumbnailRelativePath) ? null : _storageAccess.GetUrlForRelativePath(x.ThumbnailRelativePath)
                }).ToList()
            };

            return(View(vm));
        }
Example #10
0
        public IActionResult Index()
        {
            var result = _registryService.GetImages();

            if (result.IsLeft())
            {
                return(RedirectError("Can't get image catalog"));
            }

            var names = from image in result.Right
                        select image.Name;

            var model = new ImageListViewModel()
            {
                Images = names
            };

            return(View("Index", model));
        }
        // GET: Image
        public ViewResult List(string category, int page = 1)
        {
            ImageListViewModel viewModel = new ImageListViewModel
            {
                Images = imgRepository.ImgObjs
                         .Where(p => category == null || p.FileName == category)
                         .OrderBy(p => p.ImgObjId)
                         .Skip((page - 1) * PageSize)
                         .Take(PageSize),
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = category == null?
                                   imgRepository.ImgObjs.Count() :
                                       imgRepository.ImgObjs.Where(e => e.FileName == category).Count()
                },
                CurrentCategory = category
            };

            return(View(viewModel));
        }
Example #12
0
        public PicsViewModel()
        {
            FilePath path = FilePath.Make(@"f:\download\data.dat");
            _library = new Library.FileIndex(path);
             /*
            _library.AddDirectory("F:\\Photos\\Amsterdam 2010\\England");
            */



            _libraryViewModel = new ImageListViewModel(_library);

            _imageCtrlViewModel = new ImageCtrlViewModel(_libraryViewModel);
            _libraryCtrlViewModel = new LibraryCtrlViewModel(_libraryViewModel);

            _imageCtrlViewModel.PropertyChanged += _imageCtrlViewModel_PropertyChanged;

            _imageCtrlViewModel.SetList(_libraryViewModel, _libraryViewModel[0]);

            _viewMode = PicsViewModel.ViewMode.Content;
            ViewModeChanged();

        }
Example #13
0
        public ActionResult List()
        {
            var imageListViewModel = new ImageListViewModel
            {
                ImageCount = _db.Images.Count()
            };

            var imageList = new List <ImageViewModel>();

            foreach (var item in _db.Images)
            {
                string imageBase64Data = Convert.ToBase64String(item.ImageData);
                string imageDataURL    = string.Format("data:image/jpg;base64,{0}", imageBase64Data);
                var    image           = new ImageViewModel {
                    ImageTitle = item.ImageTitle,
                    ImageData  = imageDataURL
                };
                imageList.Add(image);
            }
            imageListViewModel.Images = imageList;

            return(View("List", imageListViewModel));
        }
        public async Task <IActionResult> PendingImages()
        {
            var    claims = User.Claims.ToList();
            string subId  = claims.FirstOrDefault(x => x.Type == Consts.Claims.Sub)?.Value;

            if (!await _aadHelper.IsAdminBySub(subId))
            {
                return(Unauthorized());
            }

            var images = await _dataAccess.GetPendingImages();

            var vm = new ImageListViewModel()
            {
                Images = images?.Select(x => new ImageListViewModel.Image()
                {
                    Id           = x.ImageId ?? 0,
                    Url          = _storageAccess.GetUrlForRelativePath(x.RelativePath),
                    ThumbnailUrl = string.IsNullOrWhiteSpace(x.ThumbnailRelativePath) ? null : _storageAccess.GetUrlForRelativePath(x.ThumbnailRelativePath)
                }).ToList()
            };

            return(View(vm));
        }
 public LayoutBaseMacro()
 {
     ImageListViewModel          = new ImageListViewModel();
     _worker.DoWork             += worker_DoWork;
     _worker.RunWorkerCompleted += _worker_RunWorkerCompleted;
 }
Example #16
0
 public ImageCtrlViewModel(ImageListViewModel library)
 {
     PanZoom = new PanZoomViewModel();
     _images = new List<ImageViewModel>();
     _current = -1;
 }
Example #17
0
        public ImageListPage(ImageListViewModel imageListViewModel)
        {
            InitializeComponent();

            BindingContext = viewModel = imageListViewModel;
        }