Author: miguel
Date: 2006-05-18 21:24:28 -0400 (Thu, 18 May 2006)
New Revision: 60854

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
Log:
2006-05-18  Miguel de Icaza  <[EMAIL PROTECTED]>

        * 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. 



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-18 23:49:31 UTC (rev 60853)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-19 01:24:28 UTC (rev 60854)
@@ -1,3 +1,11 @@
+2006-05-18  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
 
        * ThemeWin32Classic.cs: Don't use endcaps, they mess the drawing

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-05-18 23:49:31 UTC (rev 60853)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-05-19 01:24:28 UTC (rev 60854)
@@ -734,12 +734,15 @@
                
                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;
+                                       }
                                }
                        }
                        

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2006-05-18 23:49:31 UTC (rev 60853)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2006-05-19 01:24:28 UTC (rev 60854)
@@ -1818,7 +1818,7 @@
                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 @@
                        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 @@
                        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 @@
                        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 @@
                                // 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 @@
                        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 @@
                        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 @@
                                // 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 @@
                        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 @@
                        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 @@
                        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];
                                }
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to