// When panel is about to be shown
        public override void OnShow()
        {
            searchingframe.Visible = false;
            inputframe.Visible     = true;

            // Setup directory buttons
            DirectoryList dirs = new DirectoryList(General.Settings.LibraryRoot, null, false);

            for (int i = 0; i < dirbuttons.Length; i++)
            {
                if (i < dirs.DirectoryCount)
                {
                    dirbuttons[i].Visible = true;
                    dirbuttons[i].Text    = dirs[i].filetitle;
                    dirbuttons[i].Tag     = dirs[i].filepathname;
                }
                else
                {
                    dirbuttons[i].Visible = false;
                }
            }

            searchtext.Text = "";

            UpdateSearchButton();

            base.OnShow();
        }
Esempio n. 2
0
        // This shows search results in the browser
        public void ShowSearchResults(string searchword, List <string> searchdirectories)
        {
            currentpath   = General.Settings.LibraryRoot;
            searchstring  = searchword;
            searchresults = true;
            numbuttons    = SINGLE_COL_NUM_BUTTONS;

            // Combine search results from all given directories
            allitems = null;
            foreach (string dirname in searchdirectories)
            {
                DirectoryList dirlist = new DirectoryList(dirname, SUPPORTFORMATS, true, "*" + searchword + "*");
                if (allitems == null)
                {
                    allitems = dirlist;
                }
                else
                {
                    allitems += dirlist;
                }
            }

            RefreshDirButtons();
            if (this.Visible)
            {
                RefreshFilesList(true);
            }
        }
        // When panel is about to be shown
        public override void OnShow()
        {
            searchingframe.Visible = false;
            inputframe.Visible = true;

            // Setup directory buttons
            DirectoryList dirs = new DirectoryList(General.Settings.LibraryRoot, null, false);
            for(int i = 0; i < dirbuttons.Length; i++)
            {
                if(i < dirs.DirectoryCount)
                {
                    dirbuttons[i].Visible = true;
                    dirbuttons[i].Text = dirs[i].filetitle;
                    dirbuttons[i].Tag = dirs[i].filepathname;
                }
                else
                {
                    dirbuttons[i].Visible = false;
                }
            }

            searchtext.Text = "";

            UpdateSearchButton();

            base.OnShow();
        }
Esempio n. 4
0
        // Constructor for two combined lists
        public DirectoryList(DirectoryList a, DirectoryList b)
        {
            this.path = "";

            this.directories = new DirectoryEntry[a.directories.Length + b.directories.Length];
            Array.Copy(a.directories, 0, this.directories, 0, a.directories.Length);
            Array.Copy(b.directories, 0, this.directories, a.directories.Length, b.directories.Length);

            this.files = new DirectoryEntry[a.files.Length + b.files.Length];
            Array.Copy(a.files, 0, this.files, 0, a.files.Length);
            Array.Copy(b.files, 0, this.files, a.files.Length, b.files.Length);

            UpdateAllItemsList();
        }
Esempio n. 5
0
        // Constructor for two combined lists
        public DirectoryList(DirectoryList a, DirectoryList b)
        {
            this.path = "";

            this.directories = new DirectoryEntry[a.directories.Length + b.directories.Length];
            Array.Copy(a.directories, 0, this.directories, 0, a.directories.Length);
            Array.Copy(b.directories, 0, this.directories, a.directories.Length, b.directories.Length);

            this.files = new DirectoryEntry[a.files.Length + b.files.Length];
            Array.Copy(a.files, 0, this.files, 0, a.files.Length);
            Array.Copy(b.files, 0, this.files, a.files.Length, b.files.Length);

            UpdateAllItemsList();
        }
Esempio n. 6
0
        // This shows all files/directories in the list for the given directory and offset
        private void RefreshFilesList(bool animate)
        {
            animatefilestimer.Stop();

            // Make list of files
            if (!searchresults)
            {
                numbuttons = DOUBLE_COL_NUM_BUTTONS;
                allitems   = new DirectoryList(currentpath, SUPPORTFORMATS, false);
            }

            if (listoffset > (allitems.TotalCount - filebuttons.Length))
            {
                listoffset = allitems.TotalCount - filebuttons.Length;
            }
            if (listoffset < 0)
            {
                listoffset = 0;
            }

            // Make matching array for selection
            itemselected = new bool[allitems.TotalCount];

            UpdateFileItems();

            // Update visibility
            searchbutton.Visible = false;
            for (int i = 0; i < filebuttons.Length; i++)
            {
                filebuttons[i].Visible = !animate && !string.IsNullOrEmpty(filebuttons[i].Text);
                filebuttons[i].StopInfoFlash();
            }

            if (animate)
            {
                animatefilestimer.Start();
            }

            UpdateButtons();
        }
        // This shows all files/directories in the list for the given directory and offset
        private void RefreshFilesList(bool animate)
        {
            animatefilestimer.Stop();

            // Make list of files
            if(!searchresults)
            {
                numbuttons = DOUBLE_COL_NUM_BUTTONS;
                allitems = new DirectoryList(currentpath, SUPPORTFORMATS, false);
            }

            if(listoffset > (allitems.TotalCount - filebuttons.Length))
                listoffset = allitems.TotalCount - filebuttons.Length;
            if(listoffset < 0)
                listoffset = 0;

            // Make matching array for selection
            itemselected = new bool[allitems.TotalCount];

            UpdateFileItems();

            // Update visibility
            searchbutton.Visible = false;
            for(int i = 0; i < filebuttons.Length; i++)
            {
                filebuttons[i].Visible = !animate && !string.IsNullOrEmpty(filebuttons[i].Text);
                filebuttons[i].StopInfoFlash();
            }

            if(animate)
                animatefilestimer.Start();

            UpdateButtons();
        }
        // This shows search results in the browser
        public void ShowSearchResults(string searchword, List<string> searchdirectories)
        {
            currentpath = General.Settings.LibraryRoot;
            searchstring = searchword;
            searchresults = true;
            numbuttons = SINGLE_COL_NUM_BUTTONS;

            // Combine search results from all given directories
            allitems = null;
            foreach(string dirname in searchdirectories)
            {
                DirectoryList dirlist = new DirectoryList(dirname, SUPPORTFORMATS, true, "*" + searchword + "*");
                if(allitems == null)
                    allitems = dirlist;
                else
                    allitems += dirlist;
            }

            RefreshDirButtons();
            if(this.Visible)
                RefreshFilesList(true);
        }