Exemplo n.º 1
0
        /// <summary>
        /// SortByColumn
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="sortBy"></param>
        /// <param name="sortOrder"></param>
        /// <param name="gridDivId"></param>
        /// <returns>bool</returns>
        public static bool SortByColumn(IWebDriver driver, string sortBy, System.Windows.Forms.SortOrder sortOrder, string gridDivId = Constants.GridId)
        {
            var actualResult   = new List <string>();
            var expectedResult = new List <string>();

            if (!string.IsNullOrEmpty(sortBy))
            {
                var columnName = BuildTable(gridDivId, driver);
                if (columnName.IndexOf(sortBy) > -1)
                {
                    var element = driver.FindElement(By.LinkText(sortBy), 20, true);
                    ExecuteJavaScriptClickEvent(element, driver);
                    if (sortOrder == System.Windows.Forms.SortOrder.Descending)
                    {
                        var elementDesc = driver.FindElement(By.LinkText(sortBy), 20, true);
                        ExecuteJavaScriptClickEvent(elementDesc, driver); //To sort by descending, click the link button twice.
                    }
                    actualResult   = ValidateGridColumnValue(gridDivId, driver, sortBy).Where(item => !(item.Contains("Go to page"))).ToList();
                    actualResult   = AppendValueForSorting(actualResult, sortOrder == SortOrder.Ascending);
                    expectedResult = (sortOrder == SortOrder.Descending) ? actualResult.OrderByDescending(item => item).ToList() :
                                     actualResult.OrderBy(item => item).ToList();
                }
                else
                {
                    return(false);
                }
                return(actualResult.SequenceEqual(expectedResult));
            }
            return(false);
        }
        private void dataGridViewAccount_Sorted(object sender, EventArgs e)
        {
            DataGridViewColumn column = dgvClients.SortedColumn;

            System.Windows.Forms.SortOrder sortOrder = dgvClients.SortOrder;
            _pagination.Sort(column.Name, sortOrder.ToString());
        }
Exemplo n.º 3
0
 private void LvColumnClick(object o, ColumnClickEventArgs e)
 {
     try
     {
         if (lv.Visible == true)
         {
             string first = lv.Items[0].SubItems[e.Column].Text;
             string last  = lv.Items[lv.Items.Count - 1].SubItems[e.Column].Text;
             System.Windows.Forms.SortOrder sort_order1 = SortingListView.getSortedOrder(first, last);
             this.lv.ListViewItemSorter = new SortingListView(e.Column, sort_order1);
         }
         else
         {
             string first = lvCopy.Items[0].SubItems[e.Column].Text;
             string last  = lvCopy.Items[lvCopy.Items.Count - 1].SubItems[e.Column].Text;
             System.Windows.Forms.SortOrder sort_order1 = SortingListView.getSortedOrder(first, last);
             this.lvCopy.ListViewItemSorter = new SortingListView(e.Column, sort_order1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorting error");
         MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
        /// <summary>
        /// Sort the data list. Usually in response to clicking a column on the list view.
        /// </summary>
        /// <param name="sortColumnNumber">The column number to sort.</param>
        /// <param name="sortOrder">Order in which to perform the sort (Ascending or Descending).</param>
        public override void SortDataList(int sortColumnNumber, System.Windows.Forms.SortOrder sortOrder)
        {
            if (dataList != null)
            {
                dataList.Sort(delegate(DataItem firstItem, DataItem secondItem)
                {
                    int result = 0;

                    if (sortColumnNumber == 0)
                    {
                        // Sort the data by first name
                        result = firstItem.Word.CompareTo(secondItem.Word);
                    }
                    else if (sortColumnNumber == 1)
                    {
                        // Sort the data by last name
                        result = firstItem.Length.CompareTo(secondItem.Length);
                    }
                    else if (sortColumnNumber == 2)
                    {
                        // Sort the data by last name
                        result = firstItem.Score.CompareTo(secondItem.Score);
                    }

                    if (sortOrder == SortOrder.Descending)
                    {
                        result = result * (-1); // Reverse the result for descending order
                    }
                    return(result);
                });
            }
        }
        public void SetSortIcon(int ColumnIndex, System.Windows.Forms.SortOrder Order)
        {
            IntPtr ColumnHeader = SendMessage(this.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);

            for (int ColumnNumber = 0; ColumnNumber <= this.Columns.Count - 1; ColumnNumber++)
            {
                IntPtr   ColumnPtr = new IntPtr(ColumnNumber);
                LVCOLUMN lvColumn  = new LVCOLUMN();
                lvColumn.mask = HDI_FORMAT;
                SendMessageLVCOLUMN(ColumnHeader, HDM_GETITEM, ColumnPtr, ref lvColumn);

                if (!(Order == System.Windows.Forms.SortOrder.None) && ColumnNumber == ColumnIndex)
                {
                    switch (Order)
                    {
                    case System.Windows.Forms.SortOrder.Ascending:
                        lvColumn.fmt &= ~HDF_SORTDOWN;
                        lvColumn.fmt |= HDF_SORTUP;
                        break;

                    case System.Windows.Forms.SortOrder.Descending:
                        lvColumn.fmt &= ~HDF_SORTUP;
                        lvColumn.fmt |= HDF_SORTDOWN;
                        break;
                    }
                }
                else
                {
                    lvColumn.fmt &= ~HDF_SORTDOWN & ~HDF_SORTUP;
                }

                SendMessageLVCOLUMN(ColumnHeader, HDM_SETITEM, ColumnPtr, ref lvColumn);
            }
        }
Exemplo n.º 6
0
 private void SetSortedColumns()
 {
     if (dgvInquiry.SortedColumn != null)
     {
         sortedColumn  = dgvInquiry.SortedColumn;
         sortDirection = dgvInquiry.SortOrder;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ListViewColumnSorter()
        {
            ColumnToSort = 0;

            OrderOfSort = System.Windows.Forms.SortOrder.None;

            ObjectCompare = new System.Collections.CaseInsensitiveComparer();
        }
Exemplo n.º 8
0
 private void dataGridView_Sorted(object sender, EventArgs e)
 {
     if (dataGridView.SortedColumn != null)
     {
         _sortedColumn    = dataGridView.SortedColumn;
         _sortedDirection = dataGridView.SortOrder;
     }
 }
Exemplo n.º 9
0
 private void SaveSort()
 {
     if (dgvData.SortedColumn != null)
     {
         SortColumn = dgvData.SortedColumn;
         SortOrder  = dgvData.SortOrder;
     }
 }
 public BeforeSortingEventArgs(OLVColumn column, System.Windows.Forms.SortOrder order, OLVColumn column2, System.Windows.Forms.SortOrder order2)
 {
     this.ColumnToGroupBy       = column;
     this.GroupByOrder          = order;
     this.ColumnToSort          = column;
     this.SortOrder             = order;
     this.SecondaryColumnToSort = column2;
     this.SecondarySortOrder    = order2;
 }
Exemplo n.º 11
0
 public AfterSortingEventArgs(BeforeSortingEventArgs args)
 {
     this.columnToGroupBy       = args.ColumnToGroupBy;
     this.groupByOrder          = args.GroupByOrder;
     this.columnToSort          = args.ColumnToSort;
     this.sortOrder             = args.SortOrder;
     this.secondaryColumnToSort = args.SecondaryColumnToSort;
     this.secondarySortOrder    = args.SecondarySortOrder;
 }
Exemplo n.º 12
0
 public AfterSortingEventArgs(OLVColumn groupColumn, System.Windows.Forms.SortOrder groupOrder, OLVColumn column, System.Windows.Forms.SortOrder order, OLVColumn column2, System.Windows.Forms.SortOrder order2)
 {
     this.columnToGroupBy       = groupColumn;
     this.groupByOrder          = groupOrder;
     this.columnToSort          = column;
     this.sortOrder             = order;
     this.secondaryColumnToSort = column2;
     this.secondarySortOrder    = order2;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 public CListViewColumnSorter()
 {
     // 默认按第一列排序
     ColumnToSort = 0;
     // 排序方式为不排序
     OrderOfSort = System.Windows.Forms.SortOrder.None;
     // 初始化CaseInsensitiveComparer类对象
     ObjectCompare = new System.Collections.CaseInsensitiveComparer();
 }
Exemplo n.º 14
0
        void view_Load(object sender, EventArgs e)
        {
            BaseView bv = sender as BaseView;

            if (bv == null || bv.dgView.Columns.Count < 1)
            {
                return;
            }

            string      viewName = sender.GetType().Name;
            CfgViewData viewData = null;

            foreach (CfgViewData v in curUser.Cfg.Views)
            {
                if (v.Name == viewName)
                {
                    viewData = v;
                    break;
                }
            }
            if (viewData == null || viewData.Columns == null || viewData.Columns.Count < 1)
            {
                return;
            }
            // restore column layout
            foreach (DataGridViewColumn col in bv.dgView.Columns)
            {
                foreach (CfgColumnData ini in viewData.Columns)
                {
                    if (col.DataPropertyName == ini.DataPropertyName)
                    {
                        if (col.DisplayIndex >= 0 && col.DisplayIndex < bv.dgView.Columns.Count)
                        {
                            col.DisplayIndex = ini.DisplayIndex;
                            col.Width        = (ini.Width < 0 || ini.Width > 1000)?100:ini.Width;
                        }
                        break;
                    }
                }
            }
            // restore sorting
            if (viewData.SortColIdx >= 0 && viewData.SortColIdx < bv.dgView.Columns.Count)
            {
                DataGridViewColumn             newCol   = bv.dgView.Columns[viewData.SortColIdx];
                System.Windows.Forms.SortOrder newOrder = viewData.SortAsc?System.Windows.Forms.SortOrder.Ascending:System.Windows.Forms.SortOrder.Descending;
                if (bv.dgView.SortedColumn != newCol || bv.dgView.SortOrder != newOrder)
                {
                    if (bv.dgView.SortedColumn != null && bv.dgView.SortedColumn != newCol)
                    {
                        bv.dgView.SortedColumn.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.None;
                    }

                    bv.dgView.Sort(newCol, viewData.SortAsc?ListSortDirection.Descending:ListSortDirection.Descending);
                    bv.dgView.SortedColumn.HeaderCell.SortGlyphDirection = newOrder;
                }
            }
        }
Exemplo n.º 15
0
 public SortingData(DataGridView gridView)
 {
     this.SortOrder    = gridView.SortOrder;
     this.SortedColumn = gridView.SortedColumn;
     this.Point        = (gridView.CurrentCell != null ? new Point(gridView.CurrentCell.ColumnIndex, gridView.CurrentCell.RowIndex) : new Point(-1, -1));
     foreach (DataGridViewRow selectedRow in gridView.SelectedRows)
     {
         this.SelectedIndexes.Add(selectedRow.Index);
     }
 }
Exemplo n.º 16
0
 public DataGridComparer(System.Windows.Forms.SortOrder sortOrder)
 {
     if (sortOrder == System.Windows.Forms.SortOrder.Descending)
     {
         sortOrderModifier = -1;
     }
     else if (sortOrder == System.Windows.Forms.SortOrder.Ascending)
     {
         sortOrderModifier = 1;
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// ¹¹Ô캯Êý
        /// </summary>
        public ListViewColumnSorter()
        {
            // ĬÈÏ°´µÚÒ»ÁÐÅÅÐò
            ColumnToSort = 0;

            // ÅÅÐò·½Ê½Îª²»ÅÅÐò
            OrderOfSort = System.Windows.Forms.SortOrder.None;

            // ³õʼ»¯CaseInsensitiveComparerÀà¶ÔÏó
            ObjectCompare = new System.Collections.CaseInsensitiveComparer();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Class constructor.  Initializes various elements
        /// </summary>
        public ListViewColumnSorter()
        {
            // Initialize the column to '0'
            ColumnToSort = 0;

            // Initialize the sort order to 'none'
            OrderOfSort = System.Windows.Forms.SortOrder.None;

            // Initialize the CaseInsensitiveComparer object
            ObjectCompare = new CaseInsensitiveComparer();
        }
Exemplo n.º 19
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public ListViewColumnSorter()
        {
            // 默认按第一列排序
            ColumnToSort = 0;

            // 排序方式为不排序
            OrderOfSort = System.Windows.Forms.SortOrder.None;

            // 初始化CaseInsensitiveComparer类对象
            ObjectCompare = new System.Collections.CaseInsensitiveComparer();
        }
Exemplo n.º 20
0
 public RowComparer(SortOrder sortOrder)
 {
     if (sortOrder == SortOrder.Descending)
     {
         sortOrderModifier = -1;
     }
     else if (sortOrder == SortOrder.Ascending)
     {
         sortOrderModifier = 1;
     }
 }
        /// <summary>
        /// Sort Datagrid
        /// <param name="e">event arguments</param>
        protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        {
            SuspendGridLayout();
            TableLayoutBackup layout = new TableLayoutBackup(this, KeyColumnName);

            bool sortComboBoxCell = _cmbItemSources.ContainsKey(e.ColumnIndex);

            //Get the sort column (if it is a columnbox, the column that is bounded to the datasource has to be sorted)
            DataGridViewColumn column = sortComboBoxCell ?
                                        this.Columns[GetBoundedColumnIndex(e.ColumnIndex)] : this.Columns[e.ColumnIndex];


            //sort order is ascending, if columns last sort order has not been ascending
            System.Windows.Forms.SortOrder sortOrder = System.Windows.Forms.SortOrder.Ascending;
            ListSortDirection listSortOrder          = ListSortDirection.Ascending;

            if (column.HeaderCell.SortGlyphDirection == System.Windows.Forms.SortOrder.Ascending)
            {
                listSortOrder = ListSortDirection.Descending;
                sortOrder     = System.Windows.Forms.SortOrder.Descending;
            }

            // Remove SortGlyphs (necessary because of comboboxe cells)
            foreach (DataGridViewColumn col in this.Columns)
            {
                col.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.None;
            }

            //Glyphs is needed on the ComboBoxCell, sorting happens on the bounded cell
            if (sortComboBoxCell)
            {
                this.Columns[e.ColumnIndex].SortMode = DataGridViewColumnSortMode.Programmatic;
                this.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = sortOrder;
            }

            column.SortMode = DataGridViewColumnSortMode.Programmatic;
            column.HeaderCell.SortGlyphDirection = sortOrder;
            this.Sort(column, listSortOrder);

            //Refresh comboboxes (displayed value is lost because comboBox cell is not directly bounded to the datasource
            foreach (int colIdx in _cmbItemSources.Keys)
            {
                string columnName = this.Columns[GetBoundedColumnIndex(colIdx)].Name;
                RefreshCellBoundComboBox(columnName);
            }

            base.OnColumnHeaderMouseClick(e);

            layout.RestoreLayout();
            ResumeGridLayout();
        }
Exemplo n.º 22
0
 private void LvColumnClick(object o, ColumnClickEventArgs e)
 {
     try
     {
         string first = lv.Items[0].SubItems[e.Column].Text;
         string last  = lv.Items[lv.Items.Count - 1].SubItems[e.Column].Text;
         System.Windows.Forms.SortOrder sort_order1 = SortingListView.getSortedOrder(first, last);
         this.lv.ListViewItemSorter = new SortingListView(e.Column, sort_order1);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorting error");
     }
 }
Exemplo n.º 23
0
 private void SetSortedColumns()
 {
     try
     {
         if (dgvVendor.SortedColumn != null)
         {
             sortedColumn  = dgvVendor.SortedColumn;
             sortDirection = dgvVendor.SortOrder;
         }
     }
     catch (Exception exc)
     {
         Utill.Common.ExceptionLogger.writeException("Vendor", exc.StackTrace);
         MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
     }
 }
Exemplo n.º 24
0
        private void Sort <T>(List <T> compareList, DataGridViewCellMouseEventArgs e)
        {
            string    strColumnName = dataGridView1.Columns[e.ColumnIndex].Name;
            SortOrder strSortOrder  = GetSortOrder(e.ColumnIndex);

            if (strSortOrder == SortOrder.Ascending)
            {
                compareList = compareList.OrderBy(x => typeof(T).GetProperty(strColumnName).GetValue(x, null)).ToList();
            }
            else
            {
                compareList = compareList.OrderByDescending(x => typeof(T).GetProperty(strColumnName).GetValue(x, null)).ToList();
            }
            dataGridView1.DataSource = compareList;
            dataGridView1.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = strSortOrder;
        }
Exemplo n.º 25
0
 public static System.Windows.Forms.SortOrder getSortedOrder(string first, string last)
 {
     System.Windows.Forms.SortOrder sort_order2 = System.Windows.Forms.SortOrder.None;
     try
     {
         double d1, d2;
         int    result;
         if (double.TryParse(first, out d1) && double.TryParse(last, out d2))
         {
             result = d1.CompareTo(d2);
         }
         else
         {
             DateTime dt1, dt2;
             if (DateTime.TryParse(first, out dt1) && DateTime.TryParse(last, out dt2))
             {
                 result = dt1.CompareTo(dt2);
             }
             else
             {
                 result = first.CompareTo(last);
             }
         }
         if (result < 0)
         {
             sort_order2 = System.Windows.Forms.SortOrder.Descending;
         }
         else
         {
             sort_order2 = System.Windows.Forms.SortOrder.Ascending;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorting Error");
     }
     return(sort_order2);
 }
Exemplo n.º 26
0
        private void gProduto_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (gProduto.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.NotSortable)
            {
                return;
            }
            if (bsProduto.Count < 1)
            {
                return;
            }
            PropertyDescriptorCollection lP = TypeDescriptor.GetProperties(new TRegistro_CadProduto());
            TList_CadProduto             lComparer;

            System.Windows.Forms.SortOrder direcao = System.Windows.Forms.SortOrder.None;
            if ((gProduto.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == System.Windows.Forms.SortOrder.None) ||
                (gProduto.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == System.Windows.Forms.SortOrder.Descending))
            {
                lComparer = new TList_CadProduto(lP.Find(gProduto.Columns[e.ColumnIndex].DataPropertyName, true), System.Windows.Forms.SortOrder.Ascending);
                foreach (DataGridViewColumn c in gProduto.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.None;
                }
                direcao = System.Windows.Forms.SortOrder.Ascending;
            }
            else
            {
                lComparer = new TList_CadProduto(lP.Find(gProduto.Columns[e.ColumnIndex].DataPropertyName, true), System.Windows.Forms.SortOrder.Descending);
                foreach (DataGridViewColumn c in gProduto.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = System.Windows.Forms.SortOrder.None;
                }
                direcao = System.Windows.Forms.SortOrder.Descending;
            }
            (bsProduto.List as TList_CadProduto).Sort(lComparer);
            bsProduto.ResetBindings(false);
            gProduto.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = direcao;
        }
Exemplo n.º 27
0
        public ListViewColumnSorter()
        {
            // Ĭ�ϰ���һ������
            ColumnToSort = 0;

            // ����ʽΪ������
            OrderOfSort = System.Windows.Forms.SortOrder.None;

            // ��ʼ��CaseInsensitiveComparer�����
            ObjectCompare = new CaseInsensitiveComparer();
        }
Exemplo n.º 28
0
 public ListViewItemStringComparer()
 {
     col = 0;
     order = System.Windows.Forms.SortOrder.Ascending;
 }
Exemplo n.º 29
0
        public static void ListView_SetHeaderSortIndicator(IntPtr hWnd, Int32 columnIdx, System.Windows.Forms.SortOrder order)
        {
            IntPtr header     = ListView_GetHeader(hWnd);
            Int32  nofColumns = Header_GetItemCount(header);

            for (int i = 0; i < nofColumns; i++)
            {
                HdItem item = new HdItem();
                item.mask = HDI_FORMAT;
                item      = Header_GetItem(header, i, item);

                if (i == columnIdx)
                {
                    item.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);

                    if (order == SortOrder.Ascending)
                    {
                        item.fmt |= HDF_SORTUP;
                    }
                    else if (order == SortOrder.Descending)
                    {
                        item.fmt |= HDF_SORTDOWN;
                    }
                }
                else
                {
                    item.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
                }

                Header_SetItem(header, i, ref item);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// 馬リストを作る
        /// </summary>
        /// <param name="wp"></param>
        public void CreateHorseList( KOEI.WP7_2012.WP7 wp, object arg )
        {
            this.ListView1.Items.Clear();
            this.wp_ = wp;

            var items = this.CreateHorseListSub( wp, arg );

            var sortOrders = new System.Windows.Forms.SortOrder[ this.ListView1.Columns.Count ];

            for( var i=0; i<sortOrders.Length; ++i ) {
                var mode = (UMAListView.Sorter.ComparerMode)this.ListView1.Columns[i].Tag;
                switch( mode )
                {
                case UMAListView.Sorter.ComparerMode.TAG_STRING:
                case UMAListView.Sorter.ComparerMode.STRING:
                case UMAListView.Sorter.ComparerMode.TAG_DATETIME:
                    sortOrders[i] = SortOrder.Ascending;
                    break;
                case UMAListView.Sorter.ComparerMode.NUMERIC:
                case UMAListView.Sorter.ComparerMode.TAG_HEXADECIMAL:
                case UMAListView.Sorter.ComparerMode.TAG_NUMERIC:
                    sortOrders[i] = SortOrder.Descending;
                    break;
                }
            }
            this.ListView1.Tag = sortOrders;
            this.ListViewItemsSort( items, this.ListViewDefaultSortColumn );

            this.ListView1.BeginUpdate();
            this.ListView1_VirtualItems = items;
            this.ListView1.VirtualListSize = items.Length;
            this.ListView1_OddColor();
            this.ListView1.EndUpdate();
        }
Exemplo n.º 31
0
 public ListViewItemComparer(int column, System.Windows.Forms.SortOrder order)
 {
     col        = column;
     this.order = order;
 }
Exemplo n.º 32
0
        //extension method for setting "Sort Icon" of the listview.



        public static void SetSortIcon(this System.Windows.Forms.ListView ListViewControl, int ColumnIndex, System.Windows.Forms.SortOrder Order)
        {
            IntPtr ColumnHeader = SendMessage(ListViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);

            for (int ColumnNumber = 0; ColumnNumber <= ListViewControl.Columns.Count - 1; ColumnNumber++)
            {
                IntPtr ColumnPtr = new IntPtr(ColumnNumber);
                HDITEM item      = new HDITEM();
                item.mask = (int)HDITEM.Mask.Format;
                SendMessageHDITEM(ColumnHeader, HDM_GETITEM, ColumnPtr, ref item);

                if (Order != SortOrder.None && ColumnNumber == ColumnIndex)
                {
                    switch (Order)
                    {
                    case SortOrder.Ascending:
                        item.fmt &= ~(int)HDITEM.Format.SortDown;
                        item.fmt |= (int)HDITEM.Format.SortUp;
                        break;

                    case SortOrder.Descending:
                        item.fmt &= ~(int)HDITEM.Format.SortUp;
                        item.fmt |= (int)HDITEM.Format.SortDown;
                        break;
                    }
                }
                else
                {
                    item.fmt &= ~(int)HDITEM.Format.SortDown & ~(int)HDITEM.Format.SortUp;
                }

                SendMessageHDITEM(ColumnHeader, HDM_SETITEM, ColumnPtr, ref item);
            }
        }
Exemplo n.º 33
0
        public static IOrderedQueryable <T> Order <T>(this IQueryable <T> source, string propertyName, System.Windows.Forms.SortOrder descending, bool anotherLevel = false)
        {
            var param    = Expression.Parameter(typeof(T), string.Empty);
            var property = Expression.PropertyOrField(param, propertyName);
            var sort     = Expression.Lambda(property, param);

            var call = Expression.Call(
                typeof(Queryable),
                (!anotherLevel ? "OrderBy" : "ThenBy") +
                (descending == System.Windows.Forms.SortOrder.Descending ? "Descending" : string.Empty),
                new[] { typeof(T), property.Type },
                source.Expression,
                Expression.Quote(sort));

            return((IOrderedQueryable <T>)source.Provider.CreateQuery <T>(call));
        }
Exemplo n.º 34
0
 public ListViewItemComparer()
 {
     col   = 0;
     order = System.Windows.Forms.SortOrder.Ascending;
 }
Exemplo n.º 35
0
 private CaseInsensitiveComparer ObjectCompare;           // 声明CaseInsensitiveComparer类对象,
 public ListViewColumnSorter()                            // 构造函数
 {
     ColumnToSort  = 0;                                   // 默认按第一列排序
     OrderOfSort   = System.Windows.Forms.SortOrder.None; // 排序方式为不排序
     ObjectCompare = new CaseInsensitiveComparer();       // 初始化CaseInsensitiveComparer类对象
 }
Exemplo n.º 36
0
 public ListViewItemStringComparer(int column, System.Windows.Forms.SortOrder order)
 {
     col = column;
     this.order = order;
 }
Exemplo n.º 37
0
 public ListViewSorter()
 {
     sortColumn = 0;
     sortOrder = System.Windows.Forms.SortOrder.None;
     comparer = Comparer.Default;
 }