예제 #1
0
        /// <summary>
        /// Make sure all entities are loaded.
        /// </summary>
        private void LoadAllEntities()
        {
            IPackage pkg = this;

            pkg.GetCommandStations().ToList();
            pkg.GetLocs().ToList();
            pkg.GetModules().ToList();
        }
예제 #2
0
        public void TestCreateNewPackage()
        {
            IPackage pkg = Package.Create();

            Assert.IsNotEmpty(pkg.Railway.Id, "Railway ID should not be empty");
            Assert.AreEqual(0, pkg.GetLocs().Count(), "There should be 0 locs");
            Assert.AreEqual(0, pkg.GetModules().Count(), "There should be 0 modules");
            Assert.AreEqual(0, pkg.GetCommandStations().Count(), "There should be 0 command stations");
        }
        /// <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();
        }