コード例 #1
0
        private void Populate(File_Directory[] dir__1, string path)
        {
            index = 0;
            int local_index = 0;

            files_folder.Items.Clear();
            Paths = new string[dir__1.Length];
            foreach (File_Directory dir in dir__1)
            {
                Paths[local_index++] = dir.fullName;
                files_folder.Items.Add(dir);
            }
            DirectoryInfo directoryInfo_1 = new DirectoryInfo(path);

            foreach (DirectoryInfo obj in directoryInfo_1.GetDirectories())
            {
                File_Directory directory = new File_Directory(obj.Name, obj.FullName);
                files_folder.Items.Add(directory);
            }
            if (Paths.Length > 0)
            {
                picture_view.ImageLocation = Paths[0];
                enable_components();
            }
            else
            {
                picture_view.ImageLocation = null;
                disable_the_components();
            }
        }
コード例 #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(((File_Directory)files_folder.SelectedItem).fullName);

            if (!directoryInfo.Exists)
            {
                return;
            }
            FileInfo[] files = directoryInfo.GetFiles("*.png");
            array_of_object = new File_Directory[files.Length];
            int i = 0;

            foreach (FileInfo file in files)
            {
                array_of_object[i++] = new File_Directory(file.Name, file.FullName);
            }
            Populate(array_of_object, ((File_Directory)files_folder.SelectedItem).fullName);
        }
コード例 #3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            files_folder.Items.Clear();
            picture_view.Image = null;
            // Text = comboBox1.SelectedItem.ToString();

            DirectoryInfo directoryInfo = new DirectoryInfo(drives_combo.SelectedItem.ToString());

            foreach (DirectoryInfo directory in directoryInfo.GetDirectories())
            {
                File_Directory obj_dir = new File_Directory(directory.Name, directory.FullName);
                files_folder.Items.Add(obj_dir);
            }
            foreach (FileInfo file in directoryInfo.GetFiles("*.png"))
            {
                File_Directory obj_dir = new File_Directory(file.Name, file.FullName);
                files_folder.Items.Add(obj_dir);
            }
            if ((directoryInfo.GetFiles("*.png")).Length == 0)
            {
                disable_the_components();
            }
        }