本文整理汇总了C#中ItemIdentifier.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ItemIdentifier.Equals方法的具体用法?C# ItemIdentifier.Equals怎么用?C# ItemIdentifier.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemIdentifier
的用法示例。
在下文中一共展示了ItemIdentifier.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectItemDown
void SelectItemDown ()
{
if (selectedItem == null)
return;
if (selectedItem.Equals (topItem)) {
for (int j = 0; j < results.Count; j++) {
if (results[j].Item2.ItemCount == 0 || results[j].Item2.ItemCount == 1 && topItem.DataSource == results[j].Item2)
continue;
selectedItem = new ItemIdentifier (
results [j].Item1,
results [j].Item2,
0
);
if (selectedItem.Equals (topItem))
goto normalDown;
break;
}
ShowTooltip ();
QueueDraw ();
return;
}
normalDown:
var i = SelectedCategoryIndex;
// check real upper bound
if (selectedItem != null) {
var curAbsoluteIndex = selectedItem == topItem ? 1 : 0;
for (int j = 0; j < i; j++) {
curAbsoluteIndex += Math.Min (maxItems, results [j].Item2.ItemCount);
}
curAbsoluteIndex += selectedItem.Item + 1;
if (curAbsoluteIndex + 1 > calculatedItems)
return;
}
var upperBound = Math.Min (maxItems, selectedItem.DataSource.ItemCount);
if (selectedItem.Item + 1 < upperBound) {
if (topItem.DataSource == selectedItem.DataSource && selectedItem.Item == upperBound - 1)
return;
selectedItem = new ItemIdentifier (selectedItem.Category, selectedItem.DataSource, selectedItem.Item + 1);
} else {
for (int j = i + 1; j < results.Count; j++) {
if (results[j].Item2.ItemCount == 0 || results[j].Item2.ItemCount == 1 && topItem.DataSource == results[j].Item2)
continue;
selectedItem = new ItemIdentifier (
results [j].Item1,
results [j].Item2,
0
);
if (selectedItem.Equals (topItem)) {
selectedItem = new ItemIdentifier (
results [j].Item1,
results [j].Item2,
1
);
}
break;
}
}
ShowTooltip ();
QueueDraw ();
}
示例2: SelectPrevCategory
void SelectPrevCategory ()
{
if (selectedItem == null)
return;
var i = SelectedCategoryIndex;
if (i > 0) {
selectedItem = new ItemIdentifier (
results [i - 1].Item1,
results [i - 1].Item2,
0
);
if (selectedItem.Equals (topItem)) {
if (topItem.DataSource.ItemCount > 1) {
selectedItem = new ItemIdentifier (
results [i - 1].Item1,
results [i - 1].Item2,
1
);
} else if (i > 1) {
selectedItem = new ItemIdentifier (
results [i - 2].Item1,
results [i - 2].Item2,
0
);
}
}
} else {
selectedItem = topItem;
}
QueueDraw ();
}
示例3: SelectItemUp
void SelectItemUp ()
{
if (selectedItem == null || selectedItem == topItem)
return;
int i = SelectedCategoryIndex;
if (selectedItem.Item > 0) {
selectedItem = new ItemIdentifier (selectedItem.Category, selectedItem.DataSource, selectedItem.Item - 1);
if (i > 0 && selectedItem.Equals (topItem)) {
SelectItemUp ();
return;
}
} else {
if (i == 0) {
selectedItem = topItem;
} else {
do {
i--;
selectedItem = new ItemIdentifier (
results [i].Item1,
results [i].Item2,
Math.Min (maxItems, results [i].Item2.ItemCount) - 1
);
if (selectedItem.Category == topItem.Category && selectedItem.Item == topItem.Item && i > 0) {
i--;
selectedItem = new ItemIdentifier (
results [i].Item1,
results [i].Item2,
Math.Min (maxItems, results [i].Item2.ItemCount) - 1
);
}
} while (i > 0 && selectedItem.DataSource.ItemCount <= 0);
if (selectedItem.DataSource.ItemCount <= 0) {
selectedItem = topItem;
}
}
}
ShowTooltip ();
QueueDraw ();
}