/[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

--- trunk/libxmltv/Core/XMLTV.cs	2013/03/10 17:41:52	118
+++ trunk/libxmltv/Core/XMLTV.cs	2013/03/10 18:19:12	120
@@ -95,6 +95,23 @@
             var list = gInstance.Programs;
             return list;
         }
+
+        public static BindingSource CreateBindingSourceForData(object data)
+        {
+            if (data == null) { throw new ArgumentNullException("data", "cannot be null"); }
+            BindingSource source = new BindingSource();
+
+            IDataSourceBindable binder = (data as IDataSourceBindable);
+            if (binder == null)
+            {
+                throw new InvalidCastException(string.Format("Cannot cast: '{0}' to '{1}'", data.GetType().Name, typeof(IDataSourceBindable).Name));
+            }
+
+            object bindable = binder.CreateBindableDataSource();
+            source.DataSource = bindable;
+            return source;
+        }
+
         #endregion
         #endregion
 

 

  ViewVC Help
Powered by ViewVC 1.1.22