Пример #1
0
        /// <summary>
        /// Add person of the selected photos
        /// </summary>
        private void add_person_photos()
        {
            ILV_photos.Items.Clear();
            ILV_photos.ClearThumbnailCache();

            // Get current person name
            KeyValuePair <string, string> item = (KeyValuePair <string, string>)CB_name.SelectedItem;
            string path = Path.Combine(person_app_path, item.Key);

            if (Directory.Exists(path))
            {
                string[] files = person.get_person_photos(path);
                if (files != null)
                {
                    foreach (string file in files)
                    {
                        if (File.Exists(file))
                        {
                            ILV_photos.Items.Add(file);
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Add files in the image list view
        /// </summary>
        /// <param name="files"></param>
        private void add_files(List <string> files)
        {
            ILV_photos.ClearThumbnailCache();

            // Db error
            if (files == null)
            {
                // TODO error
            }
            else if (files.Count() > 0)
            {
                // Add file to the ImageList

                foreach (string file in files)
                {
                    // Check if full path
                    // Full => c:/
                    // Not full => /....
                    if (!check_path(file))
                    {
                        // Get photo path
                        //string photo = Path.Combine(id, file);
                        string photo = $"{identify_dir_path}{file}";

                        // If exist add it to the Image list
                        if (File.Exists(photo))
                        {
                            ILV_photos.Items.Add(photo);
                        }
                        else
                        {
                            // Locate photo in Picture Windows folder
                            MessageBox.Show("locate");
                            string loc = locate.locate_file(file);
                            if (loc != string.Empty)
                            {
                                ILV_photos.Items.Add(loc);
                            }
                        }
                    }
                    else
                    {
                        // If exist add it to the Image list
                        if (File.Exists(file))
                        {
                            ILV_photos.Items.Add(file);
                        }
                        else
                        {
                            // Locate photo in Picture Windows folder
                            MessageBox.Show("locate");
                            string loc = locate.locate_file(file);
                            if (loc != string.Empty)
                            {
                                ILV_photos.Items.Add(loc);
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("No photo found.");
            }
        }