static void Main(string[] args)
        {
            Console.WriteLine("Client started!  Hit enter to end");
            RemotingConfiguration.Configure("CarProviderClient.exe.config");

            // Make the car provider.
            CarProvider cp = new CarProvider();

            // Get first JBC.
            JamesBondCar qCar = cp.GetJBCByIndex(0);

            // Get all JBCs.
            List <JamesBondCar> allJBCs = cp.GetAllAutos();

            // Use first car.
            UseCar(qCar);

            // Use all cars in ArrayList
            foreach (JamesBondCar j in allJBCs)
            {
                UseCar(j);
            }

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            // Use *.config file...
            RemotingConfiguration.Configure("CAOCarProviderClientLease.exe.config");

            // ... or use hard coded values.
            //RemotingConfiguration.RegisterActivatedClientType(typeof(CAOCarGeneralAsmLease.CarProvider),
            //	"http://localhost:032469");

            // Make the car provider.
            JamesBondCar[] cars =
            {
                new JamesBondCar("One",   100, false, false),
                new JamesBondCar("Two",   100, false, false),
                new JamesBondCar("Three", 100, false, false)
            };

            // Now trigger the custom ctor.
            CarProvider cp = new CarProvider(cars);

            // Adjust the lease of this type!
            ILease itfLeaseInfo = (ILease)RemotingServices.GetLifetimeService(cp);

            if (itfLeaseInfo.CurrentLeaseTime.TotalMinutes < 10.0)
            {
                itfLeaseInfo.Renew(TimeSpan.FromMinutes(1000));
            }

            // Get first JBC.
            JamesBondCar qCar = cp.GetJBCByIndex(0);

            // Get all JBCs.
            List <JamesBondCar> allJBCs = cp.GetAllAutos();

            // Use first car.
            UseCar(qCar);

            // Use all cars in ArrayList
            foreach (JamesBondCar j in allJBCs)
            {
                UseCar(j);
            }

            Console.WriteLine("Client started!  Hit enter to end");
            Console.ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            // Use hard-coded values.
            RemotingConfiguration.RegisterActivatedClientType(
                typeof(CAOCarGeneralAsm.CarProvider),
                "tcp://localhost:32469");

            // Use *.config file.
            //RemotingConfiguration.Configure("CAOCarProviderClient.exe.config");

            // Make the car provider.
            JamesBondCar[] cars =
            {
                new JamesBondCar("Viper",   100, true,  false),
                new JamesBondCar("Shaken",  100, false, true),
                new JamesBondCar("Stirred", 100, true,  true)
            };

            // Now trigger the custom ctor.
            CarProvider cp = new CarProvider(cars);

            // Get first JBC.
            JamesBondCar qCar = cp.GetJBCByIndex(0);

            // Get all JBCs.
            List <JamesBondCar> allJBCs = cp.GetAllAutos();

            // Use first car.
            UseCar(qCar);

            // Use all cars in ArrayList
            foreach (JamesBondCar j in allJBCs)
            {
                UseCar(j);
            }

            Console.WriteLine("Client started!  Hit enter to end");
            Console.ReadLine();
        }