Example #1
0
        public void Filter(string pat)
        {
            Debug.WriteLine("Testing Filter1:    " + pat);
            if (pat == "None")
            {
                pat = "";
            }
            pat = "*" + pat;
            if (pat == filter)
            {
                return;
            }
            Debug.WriteLine("Testing Filter2:    " + pat);
            Initialize();
            RetrieveSubfolders(pat);
            RetrieveFiles(pat);

            details1 = new FoderDetails()
            {
                FFNo = "Folders : " + dirs.Count.ToString(), IconPath = "folder_icon.png"
            };
            details2 = new FoderDetails()
            {
                FFNo = "Files : " + fileList.Count.ToString(), IconPath = "file_icon.png"
            };
            GetInitialItems();

            LB.ItemsSource = items;
            UpdateStackPanel();
            filter = pat;
        }
Example #2
0
        public File_Manager_Page()                                      // To be invoked only for getting the Drives and Special Folders
        {
            InitializeComponent();

            string[] drives = Environment.GetLogicalDrives();

            foreach (string dr in drives)
            {
                DriveInfo di = new DriveInfo(dr);
                if (!di.IsReady)
                {
                    Debug.WriteLine("The drive {0} could not be read", di.Name);
                    continue;
                }
                DirectoryInfo rootDir = di.RootDirectory;

                items.Add(new Folders()
                {
                    Folder = dr, IconPath = "local_disk.ico"
                });
                dirs.Add(dr);
                dictFolder[dr] = rootDir;
            }

            items.Add(new Folders()
            {
                Folder = "Documents", IconPath = "folder_icon.png"
            });
            items.Add(new Folders()
            {
                Folder = "Desktop", IconPath = "folder_icon.png"
            });
            items.Add(new Folders()
            {
                Folder = "Downloads", IconPath = "folder_icon.png"
            });
            items.Add(new Folders()
            {
                Folder = "Music", IconPath = "folder_icon.png"
            });
            items.Add(new Folders()
            {
                Folder = "Videos", IconPath = "folder_icon.png"
            });

            dirs.Add("Documents");
            dirs.Add("Desktop");
            dirs.Add("Downloads");
            dirs.Add("Music");
            dirs.Add("Videos");

            dictFolder["Documents"] = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            dictFolder["Desktop"]   = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
            dictFolder["Downloads"] = new DirectoryInfo(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "Downloads"));
            dictFolder["Music"]     = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
            dictFolder["Videos"]    = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));

            details1 = new FoderDetails()
            {
                FFNo = "Drives : " + (items.Count - 5).ToString(), IconPath = "local_disk.ico"
            };
            details2 = new FoderDetails()
            {
                FFNo = "Folders : 5", IconPath = "folder_icon.png"
            };

            LB.ItemsSource = items;
            UpdateStackPanel();

            lastItemNo = dirs.Count();
            filter     = "*";
        }