private void addTrains(TreeNode parent, IDictionary list) { foreach (DictionaryEntry trainEntry in list) { TrainContribution t = (TrainContribution)trainEntry.Value; TreeNode trainNode = new TreeNode(t.name); trainNode.Tag = t; parent.Nodes.Add(trainNode); } }
private void outputManifest(TrainContribution contrib, TextWriter xml) { xml.WriteLine("<train id='{0}'>", contrib.id); writeElement(xml, contrib.name, "name"); writeElement(xml, contrib.author, "author"); writeElement(xml, contrib.companyName, "company"); writeElement(xml, contrib.description, "description"); writeElement(xml, contrib.nickName, "nickName"); writeElement(xml, contrib.speedDisplayName, "speed"); writeElement(xml, contrib.typeName, "type"); xml.WriteLine("</train>"); }
/// <summary> /// Creates a new train and assigns it to a group. /// </summary> public Train(TrainGroup group, string _name, int length, TrainContribution _type, TrainController _controller) : base(group, _name) { this.type = _type; this.controller = _controller; TrainCarContribution[] carTypes = type.Create(length); cars = new TrainCar[length]; for (int i = 0; i < length; i++) { cars[i] = new TrainCar(this, carTypes[i], i); } calcNextTrainCarState = new CalcNextTrainCarState(this); }
/// <summary> /// /// </summary> /// <param name="group"></param> /// <param name="length"></param> /// <param name="_type"></param> public Train(TrainGroup group, int length, TrainContribution _type) : this(group, string.Format("TR{0}", iota++), length, _type, SimpleTrainControllerImpl.theInstance) { }