本文整理汇总了C#中IReorderableListAdaptor.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# IReorderableListAdaptor.Clear方法的具体用法?C# IReorderableListAdaptor.Clear怎么用?C# IReorderableListAdaptor.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReorderableListAdaptor
的用法示例。
在下文中一共展示了IReorderableListAdaptor.Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearAll
/// <summary>
/// Remove all items from list.
/// </summary>
/// <remarks>
/// <para>The event <see cref="ItemRemoving"/> is raised for each item prior to
/// clearing array and allows entire operation to be cancelled.</para>
/// </remarks>
/// <param name="adaptor">Reorderable list adaptor.</param>
/// <returns>
/// Returns a value of <c>false</c> if operation was cancelled.
/// </returns>
protected bool ClearAll(IReorderableListAdaptor adaptor) {
if (adaptor.Count == 0)
return true;
var args = new ItemRemovingEventArgs(adaptor, 0);
int count = adaptor.Count;
for (int i = 0; i < count; ++i) {
args.ItemIndex = i;
OnItemRemoving(args);
if (args.Cancel)
return false;
}
adaptor.Clear();
GUI.changed = true;
ReorderableListGUI.IndexOfChangedItem = -1;
return true;
}
示例2: ClearAll
protected bool ClearAll(IReorderableListAdaptor adaptor)
{
if (adaptor.Count == 0)
{
return true;
}
ItemRemovingEventArgs itemRemovingEventArgs = new ItemRemovingEventArgs(adaptor, 0);
int count = adaptor.Count;
for (int i = 0; i < count; i++)
{
itemRemovingEventArgs.itemIndex = i;
this.OnItemRemoving(itemRemovingEventArgs);
if (itemRemovingEventArgs.Cancel)
{
return false;
}
}
adaptor.Clear();
GUI.changed = true;
ReorderableListGUI.indexOfChangedItem = -1;
return true;
}