Пример #1
0
 void listArchive_OrderingRequested(object sender, OrderCriteria orderCriteria)
 {
     controller.Order(orderCriteria);
 }
Пример #2
0
        public void OrderList(int column)
        {
            bool ascending = false;
              if(behavior == CardListBehavior.EditorArchive)
              {
            OrderField field = OrderField.None;
            if(this.Columns[column].Equals(colName))
              field = OrderField.Name;
            if(this.Columns[column].Equals(colType))
              field = OrderField.Type;
            if(this.Columns[column].Equals(colCost))
              field = OrderField.Cost;
            if(this.Columns[column].Equals(colCharacteristics))
              field = OrderField.Characteristics;
            if(this.Columns[column].Equals(colRarity))
              field = OrderField.Rarity;
            if(this.Columns[column].Equals(colColor))
              field = OrderField.Color;
            if(this.Columns[column].Equals(colEdition))
              field = OrderField.Set;
            if(this.Columns[column].Equals(colText))
              field = OrderField.Text;
            if(this.Columns[column].Equals(colFlavorText))
              field = OrderField.FlavorText;
            if(this.Columns[column].Equals(colArtist))
              field = OrderField.Artist;

            if(field == currentOrderField)
              ascending = !orderAscending;
            else
              ascending = true;

            OrderCriteria criteria = new OrderCriteria() { Field = field, Ascending = ascending };
            OnOrderingRequested(criteria);
            //SortableList list = new SortableList(new CardItemComparer(criteria), this.dataSource.Count);
            //list.AddRange(this.dataSource);
            //this.dataSource.Clear();
            //foreach(var item in list)
            //  this.dataSource.Add((CardItem)item);
            currentOrderField = field;
            orderAscending = ascending;
              }
              else
              {
            ListViewColumnSorter columnSorter = (ListViewColumnSorter)this.ListViewItemSorter;
            if(column == columnSorter.SortColumn)
            {
              if(columnSorter.Order == SortOrder.Ascending)
            columnSorter.Order = SortOrder.Descending;
              else
            columnSorter.Order = SortOrder.Ascending;
            }
            else
            {
              columnSorter.SortColumn = column;
              columnSorter.Order = SortOrder.Ascending;
            }
            ascending = columnSorter.Order == SortOrder.Ascending;
            Sort();
              }
              for(int i = 0; i < Columns.Count; i++)
              {
            if(i == column)
              Columns[i].ImageKey = ascending ? "ASC" : "DESC";
            else
              Columns[i].ImageKey = "NONE";
              }
              this.Refresh();
        }
Пример #3
0
 protected virtual void OnOrderingRequested(OrderCriteria orderCriteria)
 {
     if(OrderingRequested != null)
     OrderingRequested(this, orderCriteria);
 }
Пример #4
0
 public CardItemComparer(OrderCriteria criteria)
 {
     this.criteria = criteria;
 }