private void LoadSecondStation() { stationElements_1_ = StationElements.Open("StationElements1.xml"); stationTopoloty_1_ = new StationTopoloty(); stationTopoloty_1_.Open("StationTopoloty1.xml", stationElements_1_.Elements); foreach (var item in stationElements_1_.Elements) { item.Top += 45; item.Left += 2000; } stationElements_1_.AddElementsToCanvas(MainCanvas); ConnectNodes(stationTopoloty_, stationTopoloty_1_, "201G", "301G"); }
public void AddObstacleCollection(StationElements StationElements, List <byte[]> ObstacleCollection, string Section) { foreach (var element in StationElements.Elements) { if (element is RailSwitch && (element as RailSwitch).SectionName.Substring(0, 3) == Section.Substring(0, 3) && (element as RailSwitch).Name == Section.Substring(4)) { byte[] obstacle = new byte[5]; obstacle[0] = 0x04; byte[] ID = System.BitConverter.GetBytes(Convert.ToInt16((element as RailSwitch).SectionName.Substring(0, 3))); Array.Copy(ID, 0, obstacle, 1, 2); obstacle[3] = ((element as RailSwitch).IsPositionNormal == true ? Convert.ToByte(1) : Convert.ToByte(2)); obstacle[4] = obstacle[3]; ObstacleCollection.Add(obstacle); } } }
private void LoadGraphicElements(string path) { stationElements_ = StationElements.Open(path); stationElements_.AddElementsToCanvas(MainCanvas); }