Example #1
0
        private void addNewDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            DialogResult result = fbd.ShowDialog();

            string[] files = Directory.GetFiles(fbd.SelectedPath);
            List<FileModel> dirFiles = new List<FileModel>();
            for(int i = 0; i < files.Length; i++)
            {
                FileModel theFile = new FileModel();
                theFile.Path = files[i].ToString();
                theFile.Name = new FileInfo(files[i]).Name;
                theFile.Size = new FileInfo(files[i]).Length;
                dirFiles.Add(theFile);
            }
            StaticValues.self.Files.Add(new DirectoryModel(fbd.SelectedPath, fbd.ToString(), dirFiles));
        }
Example #2
0
		/* a few people have been seeing the following:
Failures:
1) MonoTests.System.Windows.Forms.CommonDialogsTest.FolderBrowserDialogTest : System.ArgumentException : oldValue is the empty string.
  at System.String.Replace (System.String oldValue, System.String newValue) [0x00054] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/corlib/System/String.cs:1285 
  at System.Windows.Forms.FolderBrowserDialog+FolderBrowserTreeView.SetSelectedPath (System.String path) [0x00061] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:460 
  at System.Windows.Forms.FolderBrowserDialog+FolderBrowserTreeView.set_SelectedPath (System.String value) [0x0000c] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:363 
  at (wrapper remoting-invoke-with-check) FolderBrowserTreeView:set_SelectedPath (string)
  at System.Windows.Forms.FolderBrowserDialog.set_SelectedPath (System.String value) [0x0001a] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:223 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.FolderBrowserDialog:set_SelectedPath (string)
  at MonoTests.System.Windows.Forms.CommonDialogsTest.FolderBrowserDialogTest () [0x00094] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CommonDialogsTest.cs:260 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00040] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/corlib/System.Reflection/MonoMethod.cs:143 
		*/
		public void FolderBrowserDialogTest ()
		{
			fbd = new FolderBrowserDialog ();
			
			Assert.AreEqual ("", fbd.Description, "#83");
			
			Assert.AreEqual (Environment.SpecialFolder.Desktop, fbd.RootFolder, "#84");
			
			Assert.AreEqual ("", fbd.SelectedPath, "#85");
			
			Assert.IsTrue (fbd.ShowNewFolderButton, "#86");
			
			Assert.AreEqual ("System.Windows.Forms.FolderBrowserDialog", fbd.ToString (), "#87");
			
			string current_path = Environment.CurrentDirectory;
			fbd.SelectedPath = current_path;
			
			Assert.AreEqual (current_path, fbd.SelectedPath, "#89");
		}