Author: calberto
Date: 2008-02-05 02:03:45 -0500 (Tue, 05 Feb 2008)
New Revision: 94852

Modified:
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
Log:
2008-02-04  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * BindingsCollection.cs: Implement 2.0 CollectionChanging event.
        Also fix the arguments passed to CollectionChangeEventArgs in the
        related methods.



Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
    2008-02-05 05:57:38 UTC (rev 94851)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/BindingsCollection.cs
    2008-02-05 07:03:45 UTC (rev 94852)
@@ -67,24 +67,42 @@
                        AddCore(binding);
                }
 
-               protected virtual void AddCore(Binding dataBinding) {
+               protected virtual void AddCore (Binding dataBinding) 
+               {
+                       CollectionChangeEventArgs args = new 
CollectionChangeEventArgs (CollectionChangeAction.Add, dataBinding);
+#if NET_2_0
+                       OnCollectionChanging (args);
+#endif
                        base.List.Add(dataBinding);
-                       OnCollectionChanged(new 
CollectionChangeEventArgs(CollectionChangeAction.Add, base.List));
+                       OnCollectionChanged (args);
                }
 
                protected internal void Clear() {
                        ClearCore();
                }
 
-               protected virtual void ClearCore() {
+               protected virtual void ClearCore() 
+               {
+                       CollectionChangeEventArgs args = new 
CollectionChangeEventArgs(CollectionChangeAction.Refresh, null);
+#if NET_2_0
+                       OnCollectionChanging (args);
+#endif
                        base.List.Clear();
-                       OnCollectionChanged(new 
CollectionChangeEventArgs(CollectionChangeAction.Refresh, base.List));
+                       OnCollectionChanged (args);
                }
 
                protected virtual void 
OnCollectionChanged(System.ComponentModel.CollectionChangeEventArgs ccevent) {
                        if (CollectionChanged!=null) CollectionChanged(this, 
ccevent);
                }
 
+#if NET_2_0
+               protected virtual void OnCollectionChanging 
(CollectionChangeEventArgs args)
+               {
+                       if (CollectionChanging != null)
+                               CollectionChanging (this, args);
+               }
+#endif
+
                protected internal void Remove(Binding binding) {
                        RemoveCore(binding);
                }
@@ -94,9 +112,14 @@
                        OnCollectionChanged(new 
CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
                }
 
-               protected virtual void RemoveCore(Binding dataBinding) {
+               protected virtual void RemoveCore(Binding dataBinding) 
+               {
+                       CollectionChangeEventArgs args = new 
CollectionChangeEventArgs(CollectionChangeAction.Remove, dataBinding);
+#if NET_2_0
+                       OnCollectionChanging (args);
+#endif
                        base.List.Remove(dataBinding);
-                       OnCollectionChanged(new 
CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
+                       OnCollectionChanged (args);
                }
 
                protected internal bool ShouldSerializeMyAll() {
@@ -115,6 +138,9 @@
 
                #region Events
                public event CollectionChangeEventHandler       
CollectionChanged;
+#if NET_2_0
+               public event CollectionChangeEventHandler       
CollectionChanging;
+#endif
                #endregion      // Events
        }
 }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-05 05:57:38 UTC (rev 94851)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-05 07:03:45 UTC (rev 94852)
@@ -1,3 +1,9 @@
+2008-02-04  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * BindingsCollection.cs: Implement 2.0 CollectionChanging event.
+       Also fix the arguments passed to CollectionChangeEventArgs in the
+       related methods.
+
 2008-02-04  Geoff Norton  <[EMAIL PROTECTED]>
 
        * Hwnd.cs: The conversion to Quartz coordinates happens in

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

Reply via email to