pager
private static int[] CalculatePagerInfo(int currentPage, int totalPages)
{
var right = totalPages - currentPage;
var left = currentPage - 1;
int rightx =0 , leftx = 0;
if (right >= 4)
{
if (left >= 4)
{
rightx = leftx = 4;
}
else
{
leftx = left;
rightx = leftx == 0 ? Math.Min(right, 8 - leftx) : Math.Min(right, 9 - leftx);
}
}
else
{
rightx = right;
leftx = rightx == 0 ? Math.Min(8 - rightx, left) : Math.Min(9 - rightx, left);
}
return new int[] { leftx, rightx };
}
Written by 兴百超
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#C#
Authors
Related Tags
#c#
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#