-//
-// System.Data.DataViewManager
-//
-// Author:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Tim Coleman (tim@timcoleman.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) Ximian, Inc. 2002
-// Copyright (C) Tim Coleman, 2002
-// Copyright (C) 2005 Novell Inc,
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.IO;
-using System.Xml;
-
-namespace System.Data
-{
- /// <summary>
- /// Contains a default DataViewSettingCollection for each DataTable in a DataSet.
- /// </summary>
- //[Designer]
- [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.DataViewManagerDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
- public class DataViewManager : MarshalByValueComponent, IBindingList, ICollection, IList, ITypedList, IEnumerable
- {
- #region Fields
-
- DataSet dataSet;
- DataViewManagerListItemTypeDescriptor descriptor;
- DataViewSettingCollection settings;
- string xml;
-
- #endregion // Fields
-
- #region Constructors
-
- public DataViewManager ()
- : this (null)
- {
- }
-
- public DataViewManager (DataSet ds)
- {
- // Null argument is allowed here.
- SetDataSet (ds);
- }
-
- #endregion // Constructors
-
- #region Properties
-
- [DataSysDescription ("Indicates the source of data for this DataViewManager.")]
- [DefaultValue (null)]
- public DataSet DataSet {
- get { return dataSet; }
- set {
- if (value == null)
- throw new DataException ("Cannot set null DataSet.");
- SetDataSet (value);
- }
- }
-
- public string DataViewSettingCollectionString {
- get { return xml; }
- set {
- try {
- ParseSettingString (value);
- xml = BuildSettingString ();
- } catch (XmlException ex) {
- throw new DataException ("Cannot set DataViewSettingCollectionString.", ex);
- }
- }
- }
-
- [DataSysDescription ("Indicates the sorting/filtering/state settings for any table in the corresponding DataSet.")]
- [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public DataViewSettingCollection DataViewSettings {
- get { return settings; }
- }
-
- int ICollection.Count {
- get { return settings.Count; }
- }
-
- bool ICollection.IsSynchronized {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- object ICollection.SyncRoot {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IList.IsFixedSize {
- get { return true; }
- }
-
- bool IList.IsReadOnly {
- get { return true; }
- }
-
- object IList.this [int index] {
- get {
- if (descriptor == null)
- descriptor = new DataViewManagerListItemTypeDescriptor (this);
-
- return descriptor;
- }
-
- set { throw new ArgumentException ("Not modifiable"); }
- }
-
- bool IBindingList.AllowEdit {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.AllowNew {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.AllowRemove {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.IsSorted {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- ListSortDirection IBindingList.SortDirection {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- PropertyDescriptor IBindingList.SortProperty {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.SupportsChangeNotification {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.SupportsSearching {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- bool IBindingList.SupportsSorting {
- [MonoTODO]
- get { throw new NotImplementedException (); }
- }
-
- #endregion // Properties
-
- #region Methods
- private void SetDataSet (DataSet ds)
- {
- dataSet = ds;
- settings = new DataViewSettingCollection (this);
- xml = BuildSettingString ();
- }
-
- private void ParseSettingString (string source)
- {
- XmlTextReader xtr = new XmlTextReader (source,
- XmlNodeType.Element, null);
-
- xtr.Read ();
- if (xtr.Name != "DataViewSettingCollectionString")
- // easy way to throw the expected exception ;-)
- xtr.ReadStartElement ("DataViewSettingCollectionString");
- if (xtr.IsEmptyElement)
- return; // MS does not change the value.
-
- ArrayList result = new ArrayList ();
- xtr.Read ();
- do {
- xtr.MoveToContent ();
- if (xtr.NodeType == XmlNodeType.EndElement)
- break;
- if (xtr.NodeType == XmlNodeType.Element)
- ReadTableSetting (xtr);
- else
- xtr.Skip ();
- } while (!xtr.EOF);
- if (xtr.NodeType == XmlNodeType.EndElement)
- xtr.ReadEndElement ();
- }
-
- private void ReadTableSetting (XmlReader reader)
- {
- // Namespace is ignored BTW.
- DataTable dt = DataSet.Tables [XmlConvert.DecodeName (
- reader.LocalName)];
- // The code below might result in NullReference error.
- DataViewSetting s = settings [dt];
- string sort = reader.GetAttribute ("Sort");
- if (sort != null)
- s.Sort = sort.Trim ();
- string ads = reader.GetAttribute ("ApplyDefaultSort");
- if (ads != null && ads.Trim () == "true")
- s.ApplyDefaultSort = true;
- string rowFilter = reader.GetAttribute ("RowFilter");
- if (rowFilter != null)
- s.RowFilter = rowFilter.Trim ();
- string rsf = reader.GetAttribute ("RowStateFilter");
- if (rsf != null)
- s.RowStateFilter = (DataViewRowState)
- Enum.Parse (typeof (DataViewRowState),
- rsf.Trim ());
- reader.Skip ();
- }
-
- private string BuildSettingString ()
- {
- if (dataSet == null)
- return String.Empty;
-
- StringWriter sw = new StringWriter ();
- sw.Write ('<');
- sw.Write ("DataViewSettingCollectionString>");
- foreach (DataViewSetting s in DataViewSettings) {
- sw.Write ('<');
- sw.Write (XmlConvert.EncodeName (
- s.Table.TableName));
- sw.Write (" Sort=\"");
- sw.Write (Escape (s.Sort));
- sw.Write ('"');
- // LAMESPEC: MS.NET does not seem to handle this property as expected.
- if (s.ApplyDefaultSort)
- sw.Write (" ApplyDefaultSort=\"true\"");
- sw.Write (" RowFilter=\"");
- sw.Write (Escape (s.RowFilter));
- sw.Write ("\" RowStateFilter=\"");
- sw.Write (s.RowStateFilter.ToString ());
- sw.Write ("\"/>");
- }
- sw.Write ("</DataViewSettingCollectionString>");
- return sw.ToString ();
- }
-
- private string Escape (string s)
- {
- return s.Replace ("&", "&")
- .Replace ("\"", """)
- .Replace ("\'", "'")
- .Replace ("<", "<")
- .Replace (">", ">");
- }
-
- public DataView CreateDataView (DataTable table)
- {
- DataViewSetting s = settings [table];
- return new DataView (table, this, s.Sort, s.RowFilter, s.RowStateFilter);
- }
-
- [MonoTODO]
- void IBindingList.AddIndex (PropertyDescriptor property)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- object IBindingList.AddNew ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- int IBindingList.Find (PropertyDescriptor property, object key)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IBindingList.RemoveIndex (PropertyDescriptor property)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IBindingList.RemoveSort ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void ICollection.CopyTo (Array array, int index)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- IEnumerator IEnumerable.GetEnumerator ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- int IList.Add (object value)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IList.Clear ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- bool IList.Contains (object value)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- int IList.IndexOf (object value)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IList.Insert (int index, object value)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IList.Remove (object value)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- void IList.RemoveAt (int index)
- {
- throw new NotImplementedException ();
- }
-
- PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors)
- {
- if (dataSet == null)
- throw new DataException ("dataset is null");
-
- if (listAccessors == null || listAccessors.Length == 0) {
- ICustomTypeDescriptor desc = new DataViewManagerListItemTypeDescriptor (this);
- return desc.GetProperties ();
- }
-
- throw new NotImplementedException ();
- }
-
- string ITypedList.GetListName (PropertyDescriptor[] listAccessors)
- {
- if (dataSet != null) {
- if (listAccessors == null || listAccessors.Length == 0) {
- return dataSet.DataSetName;
- }
- }
-
- return string.Empty;
- }
-
- protected virtual void OnListChanged (ListChangedEventArgs e)
- {
- if (ListChanged != null)
- ListChanged (this, e);
- }
-
- protected virtual void RelationCollectionChanged (object sender, CollectionChangeEventArgs e)
- {
- }
-
- protected virtual void TableCollectionChanged (object sender, CollectionChangeEventArgs e)
- {
- }
-
- #endregion // Methods
-
- #region Events
-
- public event ListChangedEventHandler ListChanged;
-
- #endregion // Events
- }
-}
+//\r
+// System.Data.DataViewManager\r
+//\r
+// Author:\r
+// Rodrigo Moya (rodrigo@ximian.com)\r
+// Tim Coleman (tim@timcoleman.com)\r
+// Atsushi Enomoto (atsushi@ximian.com)\r
+//\r
+// (C) Ximian, Inc. 2002\r
+// Copyright (C) Tim Coleman, 2002\r
+// Copyright (C) 2005 Novell Inc,\r
+//\r
+\r
+//\r
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
+using System;\r
+using System.Collections;\r
+using System.ComponentModel;\r
+using System.IO;\r
+using System.Xml;\r
+\r
+namespace System.Data\r
+{\r
+ /// <summary>\r
+ /// Contains a default DataViewSettingCollection for each DataTable in a DataSet.\r
+ /// </summary>\r
+ //[Designer]\r
+ [DesignerAttribute ("Microsoft.VSDesigner.Data.VS.DataViewManagerDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]\r
+ public class DataViewManager : MarshalByValueComponent, IBindingList, ICollection, IList, ITypedList, IEnumerable\r
+ {\r
+ #region Fields\r
+\r
+ DataSet dataSet;\r
+ DataViewManagerListItemTypeDescriptor descriptor;\r
+ DataViewSettingCollection settings;\r
+ string xml;\r
+\r
+ #endregion // Fields\r
+\r
+ #region Constructors\r
+\r
+ public DataViewManager ()\r
+ : this (null)\r
+ {\r
+ }\r
+\r
+ public DataViewManager (DataSet ds)\r
+ {\r
+ // Null argument is allowed here.\r
+ SetDataSet (ds);\r
+ }\r
+\r
+ #endregion // Constructors\r
+\r
+ #region Properties\r
+\r
+ [DataSysDescription ("Indicates the source of data for this DataViewManager.")]\r
+ [DefaultValue (null)]\r
+ public DataSet DataSet {\r
+ get { return dataSet; }\r
+ set {\r
+ if (value == null)\r
+ throw new DataException ("Cannot set null DataSet.");\r
+ SetDataSet (value);\r
+ }\r
+ }\r
+\r
+ public string DataViewSettingCollectionString {\r
+ get { return xml; }\r
+ set {\r
+ try {\r
+ ParseSettingString (value);\r
+ xml = BuildSettingString ();\r
+ } catch (XmlException ex) {\r
+ throw new DataException ("Cannot set DataViewSettingCollectionString.", ex);\r
+ }\r
+ }\r
+ }\r
+\r
+ [DataSysDescription ("Indicates the sorting/filtering/state settings for any table in the corresponding DataSet.")]\r
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]\r
+ public DataViewSettingCollection DataViewSettings {\r
+ get { return settings; }\r
+ }\r
+\r
+ int ICollection.Count {\r
+ get { return settings.Count; }\r
+ }\r
+\r
+ bool ICollection.IsSynchronized {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ object ICollection.SyncRoot {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IList.IsFixedSize {\r
+ get { return true; }\r
+ }\r
+\r
+ bool IList.IsReadOnly {\r
+ get { return true; }\r
+ }\r
+\r
+ object IList.this [int index] {\r
+ get { \r
+ if (descriptor == null)\r
+ descriptor = new DataViewManagerListItemTypeDescriptor (this);\r
+\r
+ return descriptor;\r
+ }\r
+\r
+ set { throw new ArgumentException ("Not modifiable"); }\r
+ }\r
+\r
+ bool IBindingList.AllowEdit {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.AllowNew {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.AllowRemove {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.IsSorted {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ ListSortDirection IBindingList.SortDirection {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ PropertyDescriptor IBindingList.SortProperty {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.SupportsChangeNotification {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.SupportsSearching {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ bool IBindingList.SupportsSorting {\r
+ [MonoTODO]\r
+ get { throw new NotImplementedException (); }\r
+ }\r
+\r
+ #endregion // Properties\r
+\r
+ #region Methods\r
+ private void SetDataSet (DataSet ds)\r
+ {\r
+ dataSet = ds;\r
+ settings = new DataViewSettingCollection (this);\r
+ xml = BuildSettingString ();\r
+ }\r
+\r
+ private void ParseSettingString (string source)\r
+ {\r
+ XmlTextReader xtr = new XmlTextReader (source,\r
+ XmlNodeType.Element, null);\r
+\r
+ xtr.Read ();\r
+ if (xtr.Name != "DataViewSettingCollectionString")\r
+ // easy way to throw the expected exception ;-)\r
+ xtr.ReadStartElement ("DataViewSettingCollectionString");\r
+ if (xtr.IsEmptyElement)\r
+ return; // MS does not change the value.\r
+\r
+ ArrayList result = new ArrayList ();\r
+ xtr.Read ();\r
+ do {\r
+ xtr.MoveToContent ();\r
+ if (xtr.NodeType == XmlNodeType.EndElement)\r
+ break;\r
+ if (xtr.NodeType == XmlNodeType.Element)\r
+ ReadTableSetting (xtr);\r
+ else\r
+ xtr.Skip ();\r
+ } while (!xtr.EOF);\r
+ if (xtr.NodeType == XmlNodeType.EndElement)\r
+ xtr.ReadEndElement ();\r
+ }\r
+\r
+ private void ReadTableSetting (XmlReader reader)\r
+ {\r
+ // Namespace is ignored BTW.\r
+ DataTable dt = DataSet.Tables [XmlConvert.DecodeName (\r
+ reader.LocalName)];\r
+ // The code below might result in NullReference error.\r
+ DataViewSetting s = settings [dt];\r
+ string sort = reader.GetAttribute ("Sort");\r
+ if (sort != null)\r
+ s.Sort = sort.Trim ();\r
+ string ads = reader.GetAttribute ("ApplyDefaultSort");\r
+ if (ads != null && ads.Trim () == "true")\r
+ s.ApplyDefaultSort = true;\r
+ string rowFilter = reader.GetAttribute ("RowFilter");\r
+ if (rowFilter != null)\r
+ s.RowFilter = rowFilter.Trim ();\r
+ string rsf = reader.GetAttribute ("RowStateFilter");\r
+ if (rsf != null)\r
+ s.RowStateFilter = (DataViewRowState)\r
+ Enum.Parse (typeof (DataViewRowState), \r
+ rsf.Trim ());\r
+ reader.Skip ();\r
+ }\r
+\r
+ private string BuildSettingString ()\r
+ {\r
+ if (dataSet == null)\r
+ return String.Empty;\r
+\r
+ StringWriter sw = new StringWriter ();\r
+ sw.Write ('<');\r
+ sw.Write ("DataViewSettingCollectionString>");\r
+ foreach (DataViewSetting s in DataViewSettings) {\r
+ sw.Write ('<');\r
+ sw.Write (XmlConvert.EncodeName (\r
+ s.Table.TableName));\r
+ sw.Write (" Sort=\"");\r
+ sw.Write (Escape (s.Sort));\r
+ sw.Write ('"');\r
+ // LAMESPEC: MS.NET does not seem to handle this property as expected.\r
+ if (s.ApplyDefaultSort)\r
+ sw.Write (" ApplyDefaultSort=\"true\"");\r
+ sw.Write (" RowFilter=\"");\r
+ sw.Write (Escape (s.RowFilter));\r
+ sw.Write ("\" RowStateFilter=\"");\r
+ sw.Write (s.RowStateFilter.ToString ());\r
+ sw.Write ("\"/>");\r
+ }\r
+ sw.Write ("</DataViewSettingCollectionString>");\r
+ return sw.ToString ();\r
+ }\r
+\r
+ private string Escape (string s)\r
+ {\r
+ return s.Replace ("&", "&")\r
+ .Replace ("\"", """)\r
+ .Replace ("\'", "'")\r
+ .Replace ("<", "<")\r
+ .Replace (">", ">");\r
+ }\r
+\r
+ public DataView CreateDataView (DataTable table) \r
+ {\r
+ DataViewSetting s = settings [table];\r
+ return new DataView (table, this, s.Sort, s.RowFilter, s.RowStateFilter);\r
+ }\r
+\r
+ [MonoTODO]\r
+ void IBindingList.AddIndex (PropertyDescriptor property)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ object IBindingList.AddNew ()\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IBindingList.ApplySort (PropertyDescriptor property, ListSortDirection direction)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ int IBindingList.Find (PropertyDescriptor property, object key)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IBindingList.RemoveIndex (PropertyDescriptor property)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IBindingList.RemoveSort ()\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void ICollection.CopyTo (Array array, int index)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ IEnumerator IEnumerable.GetEnumerator ()\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ int IList.Add (object value)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IList.Clear ()\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ bool IList.Contains (object value)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ int IList.IndexOf (object value)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IList.Insert (int index, object value)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IList.Remove (object value)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ [MonoTODO]\r
+ void IList.RemoveAt (int index)\r
+ {\r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors)\r
+ {\r
+ if (dataSet == null)\r
+ throw new DataException ("dataset is null");\r
+\r
+ if (listAccessors == null || listAccessors.Length == 0) {\r
+ ICustomTypeDescriptor desc = new DataViewManagerListItemTypeDescriptor (this);\r
+ return desc.GetProperties ();\r
+ }\r
+ \r
+ throw new NotImplementedException ();\r
+ }\r
+ \r
+ string ITypedList.GetListName (PropertyDescriptor[] listAccessors)\r
+ {\r
+ if (dataSet != null) { \r
+ if (listAccessors == null || listAccessors.Length == 0) {\r
+ return dataSet.DataSetName;\r
+ } \r
+ } \r
+ \r
+ return string.Empty;\r
+ }\r
+ \r
+ protected virtual void OnListChanged (ListChangedEventArgs e) \r
+ {\r
+ if (ListChanged != null)\r
+ ListChanged (this, e);\r
+ }\r
+\r
+ protected virtual void RelationCollectionChanged (object sender, CollectionChangeEventArgs e) \r
+ {\r
+ ListChangedEventArgs args;\r
+\r
+ if (e.Action == CollectionChangeAction.Remove) {\r
+ args = null;\r
+ }\r
+ else if (e.Action == CollectionChangeAction.Refresh) {\r
+ args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorChanged, null);\r
+ }\r
+ else if (e.Action == CollectionChangeAction.Add) {\r
+ args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorAdded, new DataRelationPropertyDescriptor(((DataRelation) e.Element)));\r
+ }\r
+ else {\r
+ args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorDeleted, new DataRelationPropertyDescriptor(((DataRelation) e.Element)));\r
+ }\r
+\r
+ this.OnListChanged(args);\r
+ }\r
+\r
+ protected virtual void TableCollectionChanged (object sender, CollectionChangeEventArgs e) \r
+ {\r
+ }\r
+\r
+ #endregion // Methods\r
+\r
+ #region Events\r
+\r
+ public event ListChangedEventHandler ListChanged;\r
+\r
+ #endregion // Events\r
+ }\r
+}\r