本文整理汇总了C#中ObservableCollection.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.GetEnumerator方法的具体用法?C# ObservableCollection.GetEnumerator怎么用?C# ObservableCollection.GetEnumerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.GetEnumerator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromXML
//public SpriteList(XElement xElement, Project project)
//{
// this.project = project;
// LoadFromXML(xElement);
//}
internal override void LoadFromXML(XElement xRoot)
{
Sprites = new ObservableCollection<Sprite>();
foreach (XElement xSprite in xRoot.Elements("sprite"))
Sprites.Add(new Sprite(project));
IEnumerator<Sprite> enumerator = Sprites.GetEnumerator();
foreach (XElement xSprite in xRoot.Elements("sprite"))
{
enumerator.MoveNext();
enumerator.Current.LoadFromXML(xSprite);
}
}
示例2: GetEnumeratorTest
public static void GetEnumeratorTest()
{
Guid[] anArray = { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
ObservableCollection<Guid> col = new ObservableCollection<Guid>((IEnumerable<Guid>)anArray);
int i = 0;
IEnumerator<Guid> e;
for (e = col.GetEnumerator(); e.MoveNext(); ++i)
{
Assert.Equal(anArray[i], e.Current);
}
Assert.Equal(col.Count, i);
e.Dispose();
}
示例3: FindEventInSchedule
/// <summary>
/// helper method to check that an event is not in the schedule
/// </summary>
/// <param name="eventName"></param>
/// <returns></returns>
private bool FindEventInSchedule(ObservableCollection<Event> Events, string eventName)
{
bool found = false;
IEnumerator<Event> events = Events.GetEnumerator();
while (!found && events.MoveNext()) // move to first element
{
found = events.Current.Name.Contains(eventName);
}
return found;
}
示例4: VerifyEventsSavedToIsolatedStorage
public void VerifyEventsSavedToIsolatedStorage()
{
CreateAndPopulateSchedule("Tests\\Data\\GoodXML.xml");
Assert.IsTrue(IsolatedStorageSettings.ApplicationSettings.TryGetValue("eventLocations", out _schedule.eventLocations));
Assert.IsTrue(IsolatedStorageSettings.ApplicationSettings.TryGetValue("eventDays", out _schedule.eventDays));
Assert.IsTrue(IsolatedStorageSettings.ApplicationSettings.TryGetValue("eventTypes", out _schedule.eventTypes));
ObservableCollection<Event> events = new ObservableCollection<Event>();
foreach (Object o in IsolatedStorageSettings.ApplicationSettings.Values)
{
if (o is Event)
events.Add((Event)o);
}
Assert.IsNotNull(events);
IEnumerator<Event> eventEnumerator = events.GetEnumerator();
eventEnumerator.MoveNext(); //must be done after creation
Event firstEvent = eventEnumerator.Current;
Assert.IsNotNull(firstEvent);
Assert.Equals(firstEvent.Name, "First Test Event");
}
示例5: LoadFromXML
//.........这里部分代码省略.........
case "nxtMotorActionBrick":
Bricks.Add(new NxtMotorActionBrick(sprite));
break;
case "nxtMotorStopBrick":
Bricks.Add(new NxtMotorStopBrick(sprite));
break;
case "nxtMotorTurnAngleBrick":
Bricks.Add(new NxtMotorTurnAngleBrick(sprite));
break;
case "nxtPlayToneBrick":
Bricks.Add(new NxtPlayToneBrick(sprite));
break;
case "placeAtBrick":
Bricks.Add(new PlaceAtBrick(sprite));
break;
case "playSoundBrick":
Bricks.Add(new PlaySoundBrick(sprite));
break;
case "pointInDirectionBrick":
Bricks.Add(new PointInDirectionBrick(sprite));
break;
case "pointToBrick":
Bricks.Add(new PointToBrick(sprite));
break;
case "repeatBrick":
Bricks.Add(new RepeatBrick(sprite));
break;
case "setBrightnessBrick":
Bricks.Add(new SetBrightnessBrick(sprite));
break;
case "setCostumeBrick":
Bricks.Add(new SetCostumeBrick(sprite));
break;
case "setGhostEffectBrick":
Bricks.Add(new SetGhostEffectBrick(sprite));
break;
case "setSizeToBrick":
Bricks.Add(new SetSizeToBrick(sprite));
break;
case "setVolumeToBrick":
Bricks.Add(new SetVolumeToBrick(sprite));
break;
case "setXBrick":
Bricks.Add(new SetXBrick(sprite));
break;
case "setYBrick":
Bricks.Add(new SetYBrick(sprite));
break;
case "showBrick":
Bricks.Add(new ShowBrick(sprite));
break;
case "speakBrick":
Bricks.Add(new SpeakBrick(sprite));
break;
case "stopAllSoundsBrick":
Bricks.Add(new StopAllSoundsBrick(sprite));
break;
case "turnLeftBrick":
Bricks.Add(new TurnLeftBrick(sprite));
break;
case "turnRightBrick":
Bricks.Add(new TurnRightBrick(sprite));
break;
case "waitBrick":
Bricks.Add(new WaitBrick(sprite));
break;
default:
// Unknown brick
break;
}
IEnumerator<Brick> enumerator = Bricks.GetEnumerator();
foreach (XElement element in xRoot.Elements())
{
enumerator.MoveNext();
enumerator.Current.LoadFromXML(element);
}
}