/// <summary> /// Default ctor /// </summary> public ImportPackageForm(IPackage target, IPackage source) { this.target = target; this.source = source; InitializeComponent(); if ((target != null) && (source != null)) { lbAll.BeginUpdate(); Add(source.GetCommandStations(), x => target.GetCommandStation(x.Id)); Add(source.GetLocs(), x => target.GetLoc(x.Id)); Add(source.Railway.LocGroups, x => target.Railway.LocGroups.FirstOrDefault(y => y.Id == x.Id)); Add(source.GetModules(), x => target.GetModule(x.Id)); lbAll.EndUpdate(); } UpdateButtons(); }
/// <summary> /// Import this entity into the given package. /// </summary> void IImportableEntity.Import(IPackage target) { ((Package)target).Import(this); target.Railway.CommandStations.Add(target.GetCommandStation(Id)); }