Ejemplo n.º 1
0
        public void Copy(object source, object destination, bool overwrite)
        {
            // Yes, a misbehaving UI will cause problems if objects are not correctly typed.
            IFixtureContainer fixtureSource      = source as IFixtureContainer;
            IFixtureContainer fixtureDestination = destination as IFixtureContainer;

            Fixture[] fixtures;             // Want an already-enumerated set since the collections may be modified.

            if (!overwrite)
            {
                // Only copy fixtures that do not already exist.
                fixtures = fixtureSource.Fixtures.Except(fixtureDestination.Fixtures).ToArray();
            }
            else
            {
                fixtures = fixtureSource.Fixtures.ToArray();
                foreach (Fixture fixture in fixtures)
                {
                    fixtureDestination.RemoveFixture(fixture);
                }
            }

            foreach (Fixture fixture in fixtures)
            {
                fixtureDestination.InsertFixture(fixture, overwrite);
            }
        }
Ejemplo n.º 2
0
        public void Move(object source, object destination, bool overwrite)
        {
            IFixtureContainer fixtureSource      = source as IFixtureContainer;
            IFixtureContainer fixtureDestination = destination as IFixtureContainer;

            Copy(source, destination, overwrite);
            foreach (Fixture fixture in fixtureSource.Fixtures.ToArray())
            {
                fixtureSource.RemoveFixture(fixture);
            }
        }