Example #1
0
 public bool Equals(SortSpec other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Column, Column) && Equals(other.Direction, Direction));
 }
Example #2
0
        public static ViewSpec ReadXml(XmlReader reader)
        {
            var viewSpec = new ViewSpec();

            viewSpec.Name        = reader.GetAttribute("name");
            viewSpec.SublistName = reader.GetAttribute("sublist");
            var columns = new List <ColumnSpec>();
            var sorts   = new List <SortSpec>();

            if (reader.IsEmptyElement)
            {
                reader.ReadElementString("view");
                return(viewSpec);
            }
            reader.Read();
            while (true)
            {
                if (reader.IsStartElement("column"))
                {
                    columns.Add(ColumnSpec.ReadXml(reader));
                }
                else if (reader.IsStartElement("sort"))
                {
                    sorts.Add(SortSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Read();
                }
            }
            viewSpec.Sorts   = new ReadOnlyCollection <SortSpec>(sorts.ToArray());
            viewSpec.Columns = new ReadOnlyCollection <ColumnSpec>(columns.ToArray());
            return(viewSpec);
        }
Example #3
0
        public static SortSpec ReadXml(XmlReader reader)
        {
            var sortSpec = new SortSpec();

            sortSpec.Column = reader.GetAttribute("column");
            var strDirection = reader.GetAttribute("direction");

            if (strDirection != null)
            {
                sortSpec.Direction = (ListSortDirection)Enum.Parse(typeof(ListSortDirection), strDirection);
            }
            else
            {
                sortSpec.Direction = ListSortDirection.Ascending;
            }
            bool empty = reader.IsEmptyElement;

            reader.ReadElementString("sort");
            if (!empty)
            {
                reader.ReadEndElement();
            }
            return(sortSpec);
        }
Example #4
0
 public ViewSpec()
 {
     Columns = new ColumnSpec[0];
     Sorts   = new SortSpec[0];
 }
Example #5
0
 public SortSpec(SortSpec that)
 {
     Column    = that.Column;
     Direction = that.Direction;
 }