本文整理汇总了C#中SortOrder类的典型用法代码示例。如果您正苦于以下问题:C# SortOrder类的具体用法?C# SortOrder怎么用?C# SortOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortOrder类属于命名空间,在下文中一共展示了SortOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAllAsync
public async static Task<PagedList<Connection>> FindAllAsync(string type, string query = null, IEnumerable<string> fields = null, int page = 1, int pageSize = 20, string orderBy = null, SortOrder sortOrder = SortOrder.Descending)
{
var request = new FindAllConnectionsRequest()
{
Type = type,
Query = query,
PageNumber = page,
PageSize = pageSize,
OrderBy = orderBy,
SortOrder = sortOrder
};
var response = await request.ExecuteAsync();
if (response.Status.IsSuccessful == false)
throw response.Status.ToFault();
var connections = new PagedList<Connection>()
{
PageNumber = response.PagingInfo.PageNumber,
PageSize = response.PagingInfo.PageSize,
TotalRecords = response.PagingInfo.TotalRecords,
GetNextPage = async skip => await FindAllAsync(type, query, fields, page + skip + 1, pageSize)
};
connections.AddRange(response.Connections);
return connections;
}
示例2: HandleColumnClicked
public void HandleColumnClicked(System.Windows.Forms.ListView listView, ColumnClickEventArgs e)
{
// Determine if clicked column is already the column that is being sorted.
if (e.Column == this.SortColumn)
{
// Reverse the current sort direction for this column.
if (this.Order == SortOrder.Ascending)
{
this.Order = SortOrder.Descending;
}
else
{
this.Order = SortOrder.Ascending;
}
}
else
{
// Set the column number that is to be sorted; default to ascending.
this.SortColumn = e.Column;
this.Order = SortOrder.Ascending;
}
// Perform the sort with these new sort options.
listView.Sort();
}
示例3: GetBestExistingData
protected virtual List<BestMessageInfo> GetBestExistingData(string orderBy, SortOrder sortOrder, int count)
{
List<MessageData> list2;
Assert.ArgumentNotNullOrEmpty(orderBy, "orderBy");
this.AssertOrderBy(orderBy);
Guid managerRoot = this.managerRoot.InnerItem.ID.ToGuid();
List<BestMessageInfo> list = new List<BestMessageInfo>();
do
{
list2 = analyticsDataGateway.GetAllCampaignsSorted(managerRoot, orderBy, sortOrder);
if (list2.Count == 0)
{
return list;
}
int num = Math.Min(list.Count + list2.Count, count);
List<Guid> campaigns = new List<Guid>();
foreach (MessageData data in list2)
{
MessageItem message = this.FindMessage(data, managerRoot);
if ((message != null) && (this.messageSentOnlyByContextUser(message)))
{
list.Add(this.CreateRow(message, data));
if (list.Count >= num)
{
return list;
}
}
}
this.analyticsDataGateway.MarkRemovedMessages(campaigns);
}
while (list2.Count >= 20);
return list;
}
示例4: ReverseSortOrder
public void ReverseSortOrder()
{
if (SortOrder == SortOrder.Ascending)
SortOrder = SortOrder.Descending;
else
SortOrder = SortOrder.Ascending;
}
示例5: TryParseSortOrder
private bool TryParseSortOrder(string direction, out SortOrder sortOrder)
{
switch (direction.Trim().ToLower())
{
case "asc":
case "ascending":
case "a":
case "0":
sortOrder = SortOrder.Ascending;
return true;
case "desc":
case "descending":
case "d":
case "1":
sortOrder = SortOrder.Descending;
return true;
case "":
case null:
sortOrder = SortOrder.Unspecified;
return true;
default:
sortOrder = SortOrder.Unspecified;
return false;
}
}
示例6: Sort
internal Sort(LocationField field, SortOrder order, double latitude, double longitude)
{
SortField = field;
Order = order;
Latitude = latitude;
Longitude = longitude;
}
示例7: GetStudentsSorted
private IList<Student> GetStudentsSorted(int pageIndex, int pageSize, string sortField, SortOrder order)
{
//Off course you are going to use a web service/wcf/EF call instead of this
if (_students == null)
{
fillAllStudents();
}
IList<Student> result= new List<Student>();
if (order == SortOrder.ASC)
{
if (sortField.ToLower() == "age")
{
_students.OrderBy(x => x.Age).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList<Student>().ForEach(x=>result.Add(x));
}
else
{
_students.OrderBy(x => x.Name).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList<Student>().ForEach(x => result.Add(x));
}
}
else
{
if (sortField.ToLower() == "age")
{
_students.OrderByDescending(x => x.Age).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList<Student>().ForEach(x => result.Add(x));
}
else
{
_students.OrderByDescending(x => x.Name).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList<Student>().ForEach(x => result.Add(x));
}
}
return result;
}
示例8: Search
/// <summary>
/// Initializes a new instance of the <see cref="T:Switchvox.CallLogs.Search"/> class for searches where a single search criterion must be specified.
/// </summary>
/// <param name="startDate">The minimum date to search from.</param>
/// <param name="endDate">The maximum date to search to.</param>
/// <param name="searchData">A <see cref="Switchvox.CallLogs.Search.SingleItemSearchData"/> value representing the type of data this request will search for.</param>
/// <param name="data">A single value corresponding with the type of data specified in <paramref name="searchData"/></param>
/// <param name="sortOrder">How the response will be sorted</param>
/// <param name="itemsPerPage">The maximum number of records to be returned by the response. An additional <paramref name="itemsPerPage"/> number of records can be retrieved by making additional requests and modifying the <paramref name="pageNumber"/></param>
/// <param name="pageNumber">The page number of call record results to return.</param>
public Search(DateTime startDate, DateTime endDate, SingleItemSearchData searchData, string data, SortOrder sortOrder = SortOrder.Desc, int itemsPerPage = 50, int pageNumber = 1)
: base("switchvox.callLogs.search")
{
var searchDataElms = GetSingleItemSearchDataElms(searchData, data);
ConstructXml(startDate, endDate, searchDataElms, sortOrder, itemsPerPage, pageNumber);
}
示例9: ListViewColumnSorter
//---------------------------------------------------------------------
public ListViewColumnSorter()
{
ColumnToSort = 0;
OrderOfSort = SortOrder.None;
ObjectCompare = new CaseInsensitiveComparer();
Order = SortOrder.Ascending;
}
示例10: ListViewColumnSorter
public ListViewColumnSorter()
{
ColumnToSort = 0;
OrderOfSort = SortOrder.None;
numCompare = false;
ObjectCompare = new CaseInsensitiveComparer();
}
示例11: ListViewColumnSorter
/// <summary>
/// Class constructor. Initializes various elements
/// </summary>
public ListViewColumnSorter() {
// Initialize the sort order to 'none'
_orderOfSort = SortOrder.None;
// Initialize the CaseInsensitiveComparer object
_objectCompare = new CaseInsensitiveComparer(CultureInfo.CurrentCulture);
}
示例12: ColumnSort
/// <summary>
/// call this from column click.
/// </summary>
/// <param name="lvs">an instance of listviewsorter</param>
/// <param name="lv">The lv.</param>
/// <param name="column">The column.</param>
/// <param name="forceorder">if set to a value, will sort by that all the time, otherwise will sort as normal</param>
public static void ColumnSort(ListViewSorter lvs, ListView lv, int column, SortOrder? forceorder = null)
{
try
{
lv.ListViewItemSorter = lvs;
if (!(lv.ListViewItemSorter is ListViewSorter))
return;
lvs = (ListViewSorter) lv.ListViewItemSorter;
}
catch (Exception)
{
return;
}
if (forceorder != null)
{
lv.Sorting = (SortOrder) forceorder;
}
else
{
//invert sorting
lv.Sorting = lv.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;
}
lvs.ByColumn = column;
lv.Sort();
}
示例13: Add
public SortFields Add(Range key, SortOn sortOn = SortOn.Values, SortOrder order = SortOrder.Ascending, SortDataOption dataOption = SortDataOption.Normal)
{
InternalObject.GetType().InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(key, sortOn, order, dataOption));
// I'm returning this since the documentation says it returns 'SortFields' not 'SortField'
return this;
}
示例14: OrderBy
/// <summary>performance tip: expect to have only 1 order item</summary>
public OrderBy(IExpression expr, SortOrder order)
{
orderByList = new List<Pair<IExpression, SortOrder>>(1)
{
new Pair<IExpression, SortOrder>(expr, order)
};
}
示例15: SetSortIcons
public static void SetSortIcons(ListView listView, int previouslySortedColumn, int newSortColumn, SortOrder sorting) {
IntPtr headerHandle = SendMessage(listView.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
IntPtr newColumn = new IntPtr(newSortColumn);
IntPtr prevColumn = new IntPtr(previouslySortedColumn);
HDITEM hditem;
// Only update the previous item if it existed and if it was a different one.
if (previouslySortedColumn != -1 && previouslySortedColumn != newSortColumn) {
// Clear icon from the previous column.
hditem = new HDITEM();
hditem.mask = HDI_FORMAT;
ItemSendMessage(headerHandle, HDM_GETITEM, prevColumn, ref hditem);
hditem.fmt &= ~HDF_SORTDOWN & ~HDF_SORTUP;
ItemSendMessage(headerHandle, HDM_SETITEM, prevColumn, ref hditem);
}
// Set icon on the new column.
hditem = new HDITEM();
hditem.mask = HDI_FORMAT;
ItemSendMessage(headerHandle, HDM_GETITEM, newColumn, ref hditem);
if (sorting == SortOrder.Ascending) {
hditem.fmt &= ~HDF_SORTDOWN;
hditem.fmt |= HDF_SORTUP;
}
else {
hditem.fmt &= ~HDF_SORTUP;
hditem.fmt |= HDF_SORTDOWN;
}
ItemSendMessage(headerHandle, HDM_SETITEM, newColumn, ref hditem);
}