2006-05-18 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Fri, 19 May 2006 01:24:28 +0000 (01:24 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Fri, 19 May 2006 01:24:28 +0000 (01:24 -0000)
* ListView.cs: ArgumentOutOfRangeException, single versions of the
exception should throw the name of the invalid argument.

* FileDialog.cs (OnClickOpenSaveButton): Avoid crash in open if
there are no files listed.

svn path=/trunk/mcs/; revision=60854

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs

index 13ceb667ff16e69f16e3df3e079147f0e4027bca..4a234caee6b5631b0cdd62b8f32332adaf035d0a 100644 (file)
@@ -1,3 +1,11 @@
+2006-05-18  Miguel de Icaza  <miguel@novell.com>
+
+       * ListView.cs: ArgumentOutOfRangeException, single versions of the
+       exception should throw the name of the invalid argument.
+
+       * FileDialog.cs (OnClickOpenSaveButton): Avoid crash in open if
+       there are no files listed. 
+
 2006-05-18  Jackson Harper  <jackson@ximian.com>
 
        * ThemeWin32Classic.cs: Don't use endcaps, they mess the drawing
index 6276141d4efb1255a85932ae6315c2b66fc896ed..8711f61aaaafc88569b5f51210bb3184ae42c258 100644 (file)
@@ -734,12 +734,15 @@ namespace System.Windows.Forms {
                
                void OnClickOpenSaveButton (object sender, EventArgs e)
                {
-                       if (fileDialogType == FileDialogType.OpenFileDialog && mwfFileView.SelectedItems [0] != null) {
-                               string path = Path.Combine (currentDirectoryName, mwfFileView.SelectedItems [0].Text);
-                               if (Directory.Exists (path)) {
-                                       ChangeDirectory (null, path);
-                                       openSaveButton.Select ();
-                                       return;
+                       if (fileDialogType == FileDialogType.OpenFileDialog){
+                               ListView.SelectedListViewItemCollection sl = mwfFileView.SelectedItems;
+                               if (sl.Count > 0 && sl [0] != null){
+                                       string path = Path.Combine (currentDirectoryName, mwfFileView.SelectedItems [0].Text);
+                                       if (Directory.Exists (path)) {
+                                               ChangeDirectory (null, path);
+                                               openSaveButton.Select ();
+                                               return;
+                                       }
                                }
                        }
                        
index 98659fa5f17662d5555e4401d7d2fb2de83a7524..ec0f7b37390762b8a25de2cec3097f28dcb444b2 100644 (file)
@@ -1818,7 +1818,7 @@ namespace System.Windows.Forms
                public Rectangle GetItemRect (int index, ItemBoundsPortion portion)
                {
                        if (index < 0 || index >= items.Count)
-                               throw new IndexOutOfRangeException ("Invalid Index");
+                               throw new IndexOutOfRangeException ("index");
 
                        return items [index].GetBounds (portion);
                }
@@ -2053,7 +2053,7 @@ namespace System.Windows.Forms
                        public int this [int index] {
                                get {
                                        if (index < 0 || index >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("index");
                                        return (int) list [index];
                                }
                        }
@@ -2161,7 +2161,7 @@ namespace System.Windows.Forms
                        public ListViewItem this [int index] {
                                get {
                                        if (index < 0 || index >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("index");
                                        return (ListViewItem) list [index];
                                }
                        }
@@ -2269,7 +2269,7 @@ namespace System.Windows.Forms
                        public virtual ColumnHeader this [int index] {
                                get {
                                        if (index < 0 || index >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("index");
                                        return (ColumnHeader) list [index];
                                }
                        }
@@ -2397,7 +2397,7 @@ namespace System.Windows.Forms
                                // LAMESPEC: MSDOCS say greater than or equal to the value of the Count property
                                // but it's really only greater.
                                if (index < 0 || index > list.Count)
-                                       throw new ArgumentOutOfRangeException ("Index out of range.");
+                                       throw new ArgumentOutOfRangeException ("index");
 
                                value.owner = this.owner;
                                list.Insert (index, value);
@@ -2420,7 +2420,7 @@ namespace System.Windows.Forms
                        public virtual void RemoveAt (int index)
                        {
                                if (index < 0 || index >= list.Count)
-                                       throw new ArgumentOutOfRangeException ("Index out of range.");
+                                       throw new ArgumentOutOfRangeException ("index");
 
                                // TODO: Update Column internal index ?
                                list.RemoveAt (index);
@@ -2457,13 +2457,13 @@ namespace System.Windows.Forms
                        public virtual ListViewItem this [int displayIndex] {
                                get {
                                        if (displayIndex < 0 || displayIndex >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("displayIndex");
                                        return (ListViewItem) list [displayIndex];
                                }
 
                                set {
                                        if (displayIndex < 0 || displayIndex >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("displayIndex");
 
                                        if (list.Contains (value))
                                                throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "value");
@@ -2626,7 +2626,7 @@ namespace System.Windows.Forms
                                // LAMESPEC: MSDOCS say greater than or equal to the value of the Count property
                                // but it's really only greater.
                                if (index < 0 || index > list.Count)
-                                       throw new ArgumentOutOfRangeException ("Index out of range.");
+                                       throw new ArgumentOutOfRangeException ("index");
 
                                if (list.Contains (item))
                                        throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "item");
@@ -2663,7 +2663,7 @@ namespace System.Windows.Forms
                        public virtual void RemoveAt (int index)
                        {
                                if (index < 0 || index >= list.Count)
-                                       throw new ArgumentOutOfRangeException ("Index out of range.");
+                                       throw new ArgumentOutOfRangeException ("index");
 
                                list.RemoveAt (index);
                                owner.SelectedItems.list.RemoveAt (index);
@@ -2702,7 +2702,7 @@ namespace System.Windows.Forms
                        public int this [int index] {
                                get {
                                        if (index < 0 || index >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("index");
                                        return (int) list [index];
                                }
                        }
@@ -2810,7 +2810,7 @@ namespace System.Windows.Forms
                        public ListViewItem this [int index] {
                                get {
                                        if (index < 0 || index >= list.Count)
-                                               throw new ArgumentOutOfRangeException ("Index out of range.");
+                                               throw new ArgumentOutOfRangeException ("index");
                                        return (ListViewItem) list [index];
                                }
                        }