/[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/13 13:45:05	128
+++ trunk/libxmltv/Core/DataSourceBindable.cs	2013/03/13 14:39:08	130
@@ -91,22 +91,41 @@
             #region IDataSourceSortable members
             public void Sort(ref object source, params string[] args)
             {
-                ProgramDefinitionList list = null;
+                List<IProgramDefinition> list = null;
+                IOrderedEnumerable<IProgramDefinition> ordered = null;
                 try
                 {
                     list = (ProgramDefinitionList)source;
+                    ordered = list.OrderBy(s => s);
 
-                    var col = args[0].ToLower();
-                    switch (col)
+                    foreach (object arg in args)
                     {
-                        case "channelname": list =new ProgramDefinitionList( list.OrderBy(s => s.ChannelName).ToList()); break;
-                        case "start": list = new ProgramDefinitionList( list.OrderBy(s => s.Start).ToList()); break;
-                        case "stop": list = new ProgramDefinitionList( list.OrderBy(s => s.Stop).ToList()); break;
-                        case "description": list = new ProgramDefinitionList( list.OrderBy(s => s.Description).ToList()); break;
-                        case "title": list = new ProgramDefinitionList( list.OrderBy(s => s.Title).ToList()); break;
-                        case "subtitle": list = new ProgramDefinitionList(list.OrderBy(s => s.SubTitle).ToList()); break;
+                        var col = arg.ToString().ToLower();
+                        switch (col)
+                        {
+                            case "channelname": ordered = ordered.ThenBy(s => s.ChannelName); break;
+                            case "start": ordered = ordered.ThenBy(s => s.Start); break;
+                            case "stop": ordered = ordered.ThenBy(s => s.Stop); break;
+                            case "description": ordered = ordered.ThenBy(s => s.Description); break;
+                            case "title": ordered = ordered.ThenBy(s => s.Title); break;
+                            case "subtitle": ordered = ordered.ThenBy(s => s.SubTitle); break;
+                        }
                     }
 
+                    var k = ordered.ToList();
+                    
+                    //list = new ProgramDefinitionList(ordered.ToList()).ToList();
+                    //var col = args[0].ToLower();
+                    //switch (col)
+                    //{
+                    //    case "channelname": list =new ProgramDefinitionList( list.OrderBy(s => s.ChannelName).ToList()); break;
+                    //    case "start": list = new ProgramDefinitionList( list.OrderBy(s => s.Start).ToList()); break;
+                    //    case "stop": list = new ProgramDefinitionList( list.OrderBy(s => s.Stop).ToList()); break;
+                    //    case "description": list = new ProgramDefinitionList( list.OrderBy(s => s.Description).ToList()); break;
+                    //    case "title": list = new ProgramDefinitionList( list.OrderBy(s => s.Title).ToList()); break;
+                    //    case "subtitle": list = new ProgramDefinitionList(list.OrderBy(s => s.SubTitle).ToList()); break;
+                    //}
+
                 }
                 catch (Exception ex) { throw ex; }
                 if (list != null) { source = list; }

 

  ViewVC Help
Powered by ViewVC 1.1.22