/[xmltv_parser]/trunk/libxmltv/Core/XMLTV.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTV.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 120 by william, Sun Mar 10 18:19:12 2013 UTC revision 125 by william, Sun Mar 10 19:44:49 2013 UTC
# Line 102  namespace libxmltv.Core Line 102  namespace libxmltv.Core
102              BindingSource source = new BindingSource();              BindingSource source = new BindingSource();
103    
104              IDataSourceBindable binder = (data as IDataSourceBindable);              IDataSourceBindable binder = (data as IDataSourceBindable);
105              if (binder == null)              if (binder == null) { throw new InvalidCastException(string.Format("Cannot cast: '{0}' to '{1}'", data.GetType().Name, typeof(IDataSourceBindable).Name)); }
             {  
                 throw new InvalidCastException(string.Format("Cannot cast: '{0}' to '{1}'", data.GetType().Name, typeof(IDataSourceBindable).Name));  
             }  
   
106              object bindable = binder.CreateBindableDataSource();              object bindable = binder.CreateBindableDataSource();
107              source.DataSource = bindable;              source.DataSource = bindable;
108              return source;              return source;
109          }          }
110    
111            public static BindingSource CreateFilterFromDataSource(object source, params string[] args)
112            {
113                if (source == null) { throw new ArgumentNullException("source", "cannot be null"); }
114                if (args == null) { throw new ArgumentNullException("args", "cannot be null"); }
115                IDataSourceFilterable filter = (source as IDataSourceFilterable);
116                if (filter == null) { throw new InvalidCastException(string.Format("Cannot cast: '{0}' to '{1}'", source.GetType().Name, typeof(IDataSourceFilterable).Name)); }
117                object filtered = filter.Filter(source,args);
118                BindingSource bound = new BindingSource();
119                bound.DataSource = filtered;
120                return bound;
121            }
122            public static BindingSource CreateSorterFromDataSource(object source, params string[] args)
123            {
124                if (source == null) { throw new ArgumentNullException("source", "cannot be null"); }
125                if (args == null) { throw new ArgumentNullException("args", "cannot be null"); }
126                IDataSourceSortable sorter = (source as IDataSourceSortable);
127                if (sorter == null) { throw new InvalidCastException(string.Format("Cannot cast: '{0}' to '{1}'", source.GetType().Name, typeof(IDataSourceSortable).Name)); }
128                object sorted = sorter.Sort(source, args);
129                BindingSource bound = new BindingSource();
130                bound.DataSource = sorted;
131                return bound;
132            }
133          #endregion          #endregion
134          #endregion          #endregion
135    

Legend:
Removed from v.120  
changed lines
  Added in v.125

  ViewVC Help
Powered by ViewVC 1.1.22