/// <summary> /// Constructor. /// </summary> /// <param name="s">The system to display</param> public SystemDisplay(StellarSystem s) { this.ourSystem = s; InitializeComponent(); this.DataContext = this.ourSystem; lvHistory.ItemsSource = this.ourSystem.SystemHistory.LoggedEvents; }
/// <summary> /// This updates the system in the list by GUID /// </summary> /// <param name="g">The GUID of the system</param> /// <returns>True if set, false if not</returns> public bool SetSystem(StellarSystem g) { for (int i = 0; i < this.SectorSystems.Count; i++) if (this.SectorSystems[i].SystemID == g.SystemID) { this.SectorSystems[i] = g; return true; } return false; }
/// <summary> /// This gets a system by matching GUIDs /// </summary> /// <param name="g">The GUID of the system</param> /// <param name="sys">The system to be returned</param> /// <returns>True if it can retrieve it, false if it cannot.</returns> public bool GetSystem(Guid g, out StellarSystem sys) { foreach (StellarSystem s in this.SectorSystems) { if (s.SystemID == g) { sys = s; return true; } } sys = null; return false; }
/// <summary> /// Copy Constructor /// </summary> /// <param name="s">Object being copied</param> public StellarSystem(StellarSystem s) { //copy basic details this.location = new Point3D(s.location.X, s.location.Y, s.location.Z); this.SystemName = s.SystemName; this.CatalogName = s.CatalogName; this.SystemAge = s.SystemAge; this.SystemID = s.SystemID; this.SystemHistory = new StellarEventLogger(); foreach (StellarEvent ev in s.SystemHistory.LoggedEvents) { this.SystemHistory.AddLogEvent(new StellarEvent(ev)); } }
/// <summary> /// Copy Constructor /// </summary> /// <param name="s">Object being copied</param> public StellarSystem(StellarSystem s) { //copy basic details this.location = new Point3D(s.location.X, s.location.Y, s.location.Z); this.SystemName = s.SystemName; this.CatalogName = s.CatalogName; this.SystemAge = s.SystemAge; this.SystemID = s.SystemID; }