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

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

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

--- trunk/libxmltv/Core/DataSourceBindable.cs	2013/03/14 13:08:20	141
+++ trunk/libxmltv/Core/DataSourceBindable.cs	2013/03/16 17:56:55	181
@@ -163,9 +163,8 @@
                     {
                         case "channelnumber": ordered = list.ToList().FindAll(s => s.ChannelNumber == Convert.ToInt32(filtertext)); break;
                         case "channelname": ordered = list.ToList().FindAll(s => s.ChannelName.ToLower().Contains(filtertext)); break;
-                        case "start":
-                        case "stop":
-                            throw new ArgumentException("columnname", string.Format("Filtering for column: '{0}' has not been implemented", columnname));
+                        case "start": ordered = list.ToList().FindAll(s => s.Start.ToLower().Contains(filtertext)); break;
+                        case "stop": ordered = list.ToList().FindAll(s => s.Stop.ToLower().Contains(filtertext)); break;
                         case "description": ordered = list.ToList().FindAll(s => s.Description.ToLower().Contains(filtertext)); break;
                         case "title": ordered = list.ToList().FindAll(s => s.Title.ToLower().Contains(filtertext)); break;
                         case "subtitle": ordered = list.ToList().FindAll(s => s.SubTitle.ToLower().Contains(filtertext)); break;
@@ -182,7 +181,7 @@
             }
             #endregion
         }
-        private class ProgramDefintion : IProgramDefinition
+        public class ProgramDefintion : IProgramDefinition, IEquatable<IProgramDefinition>
         {
             public ProgramDefintion()
             {
@@ -196,13 +195,13 @@
                 SubTitle = string.Empty;
             }
             //public string ChannelId { get; internal set; }
-            public int ChannelNumber { get; internal set; }
-            public string ChannelName { get; internal set; }
-            public string Start { get; internal set; }
-            public string Stop { get; internal set; }
-            public string Title { get; internal set; }
-            public string SubTitle { get; internal set; }
-            public string Description { get; internal set; }
+            public int ChannelNumber { get; set; }
+            public string ChannelName { get; set; }
+            public string Start { get; set; }
+            public string Stop { get; set; }
+            public string Title { get; set; }
+            public string SubTitle { get; set; }
+            public string Description { get; set; }
 
             public override string ToString()
             {
@@ -217,7 +216,24 @@
                 }
                 return builder.ToString();
             }
-          
+
+            public bool Equals(IProgramDefinition other)
+            {
+                return this.ToString() == other.ToString();
+            }
+            public override bool Equals(object obj)
+            {
+                if (obj == null) { throw new ArgumentNullException("obj", "Object to compare cannot be null"); }
+                if (obj.GetType().IsAssignableFrom(typeof(IProgramDefinition)))
+                {
+                    return this.Equals((IProgramDefinition)obj);
+                }
+                return base.Equals(obj);
+            }
+            public override int GetHashCode()
+            {
+                return this.ToString().GetHashCode();
+            }
         }
         public ProgramList() { }
         //public object ConvertObjectData(object source) { return this.ConvertData(source); }

 

  ViewVC Help
Powered by ViewVC 1.1.22