示例#1
0
        /// <summary>
        /// Load default Library Folders.  They can be omited to create secondary libraries
        /// </summary>
        public void LoadDefaults()
        {
            string          path;
            FileLibraryItem libraryItem;

            //My Pictures
            if (this.iMyPics == -1)
            {
                path        = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
                libraryItem = new FileLibraryItem("My Pictures", path)
                {
                    Deletable = false,
                    Recursive = true,
                    Visible   = true,
                    Editable  = false,
                };
                this.AddItem(libraryItem, out this.iMyPics);
            }

            //Shared Pictures
            if (this.iSharedPics == -1)
            {
                var strBuilder = new StringBuilder(255);
                NativeMethods.SHGetSpecialFolderPath(IntPtr.Zero, strBuilder, NativeMethods.CSIDL_COMMON_DOCUMENTS, false);
                path        = strBuilder.ToString();
                libraryItem = new FileLibraryItem("Shared Pictures", path)
                {
                    Deletable = false,
                    Recursive = true,
                    Visible   = true,
                    Editable  = false,
                };
                this.AddItem(libraryItem, out this.iSharedPics);
            }
        }
示例#2
0
        /// <summary>
        /// Loads user defined items
        /// </summary>
        public void LoadUserItems()
        {
            var paths = Properties.Settings.Default.UserFolders;

            if (paths != null)
            {
                foreach (string path in paths)
                {
                    var libraryItem = new FileLibraryItem(Path.GetFileName(path), path)
                    {
                        ImageIndex = -1,
                        Deletable  = true,
                        Recursive  = true
                    };

                    this.AddItem(libraryItem, out var index);
                }
            }
        }