Exemple #1
0
        private List <PictureViewModel> GetFilteredPictureList(PictureListViewModel plvm, string tags)
        {
            List <PictureViewModel> filteredPictures = new List <PictureViewModel>();

            //load picture list into new list
            foreach (PictureViewModel picture in plvm.List)
            {
                filteredPictures.Add(picture);
            }

            //get array of Tags
            string[] tagArray = tags.Split(' ');

            //filter list
            foreach (string tag in tagArray)
            {
                foreach (PictureViewModel picture in plvm.List)
                {
                    if (picture.IPTC.Keywords != null)
                    {
                        if (!picture.IPTC.Keywords.Contains(tag) && filteredPictures.Contains(picture))
                        {
                            filteredPictures.Remove(picture);
                        }
                    }
                }
            }
            return(filteredPictures);
        }
Exemple #2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            SearchViewModel searchViewModel = new SearchViewModel(SearchBox.Text);

            if (!searchViewModel.IsActive)
            {
                PictureListViewModel pictureListViewModel = new PictureListViewModel(BusinessLayer.GetAllPictures());
                ImageHolder.ItemsSource = BusinessLayer.PicturesToImages(BusinessLayer.GetAllPictures()); //TODO: Merge with above aka use ViewModel
                MainImageHolder.Content = ImageHolder.SelectedItem;
            }
            else if (!searchViewModel.IsSpecific && !searchViewModel.HasMultiple)
            {
                PictureListViewModel pictureListViewModel = new PictureListViewModel(BusinessLayer.GetPicturesOneParam(searchViewModel.Search));
                ImageHolder.ItemsSource = BusinessLayer.PicturesToImages(BusinessLayer.GetPicturesOneParam(searchViewModel.Search)); //TODO: Merge with above aka use ViewModel
                MainImageHolder.Content = ImageHolder.SelectedItem;
            }
            else if (!searchViewModel.IsSpecific && searchViewModel.HasMultiple)
            {
                PictureListViewModel pictureListViewModel = new PictureListViewModel(BusinessLayer.GetPicturesMultipleParams(searchViewModel.MultipleSearch));
                ImageHolder.ItemsSource = BusinessLayer.PicturesToImages(BusinessLayer.GetPicturesMultipleParams(searchViewModel.MultipleSearch)); //TODO: Merge with above aka use ViewModel
                MainImageHolder.Content = ImageHolder.SelectedItem;
            }
            else if (searchViewModel.IsSpecific)
            {
                throw new System.NotImplementedException();
            }
        }
Exemple #3
0
        public void Sync()
        {
            IEnumerable <string> tmp   = Directory.EnumerateFiles(_path);
            List <string>        files = new List <string>();

            foreach (string s in tmp)
            {
                files.Add(Path.GetFileName(s));
            }

            List <IPictureModel> pics = dal.GetPictures(null, null, null, null).ToList();


            foreach (IPictureModel s in pics)
            {
                if (!files.Contains <string>(s.FileName))
                {
                    DeletePicture(s.ID);
                }
                else
                {
                    files.Remove(s.FileName);
                }
            }

            foreach (string s in files)
            {
                IPictureModel pm = new PictureModel(s);
                pm.EXIF = ExtractEXIF(s);
                pm.IPTC = ExtractIPTC(s);
                Save(pm);
            }

            pl = new PictureListViewModel(dal.GetPictures(null, null, null, null));
        }
Exemple #4
0
 public MainWindowViewModel(UpdateSources UpdatePicture, UpdateSources UpdatePhotographer, UpdateSources UpdateCamera)
 {
     _UpdatePicture      = UpdatePicture;
     _UpdatePhotographer = UpdatePhotographer;
     _UpdateCamera       = UpdateCamera;
     bl.Error           += (message) => System.Windows.MessageBox.Show(message);
     bl.Sync();
     _List       = new PictureListViewModel(bl.GetPictures(null, null, null, null));
     _CameraList = new CameraListViewModel(bl.GetCameras());
     ((PictureListViewModel)List).SetCameras(CameraList);
     _PhotographerList = new PhotographerListViewModel(bl.GetPhotographers());
     ((PictureListViewModel)List).SetPhotographers(PhotographerList);
     _Search = new SearchViewModel();
     //nicht neu instanzieren
     _Search.SearchActivated += (s, e) => List = new PictureListViewModel(bl.GetPictures(e.Searchtext, null, null, null));
 }
Exemple #5
0
        ///
        /// Initialization for the FileWindow
        ///
        public FileWindow()
        {
            InitializeComponent();
            Objects.ComboBox labelBoxDataContext = new Objects.ComboBox()
            {
                Name    = "Select License",
                Options = new List <string>()
                {
                    "Option 1",
                    "Option 2",
                    "Option 3",
                    "I don't have a license"
                }
            };
            LicenseBox.DataContext = labelBoxDataContext;

            PhotographerBox.Text        = "Select Photographer";
            PhotographerBox.ItemsSource = BusinessLayer.GetAllPhotographerNames();
            PictureListViewModel pictureListViewModel = new PictureListViewModel();

            ImageHolder.ItemsSource = pictureListViewModel.ImageList;
            MainImageHolder.Content = ImageHolder.SelectedItem;
        }
 /// <summary>
 /// Constructor
 /// setzt das currentPicture auf null und befüllt die pictureList
 /// </summary>
 public MainWindowViewModel()
 {
     pictureList    = new PictureListViewModel();
     CurrentPicture = null;
 }