Example #1
0
        /**
         * This method shows how to connect to zones and hook up a basic message handler
         * @param args
         */
        private void StartAgent(String[] args)
        {
            this.Initialize();
            NameValueCollection parameters = AdkExamples.parseCL(this, args);
            //    /url http://127.0.0.1:7080/test /zone test /pull /sourceID SimpleProvider
            String zoneId = parameters["zone"];
            String url    = parameters["url"];

            if (zoneId == null || url == null)
            {
                Console.WriteLine("The /zone and /url parameters are required");
                Environment.Exit(0);
            }


            // 1) Get an instance of the zone to connect to
            IZone zone = ZoneFactory.GetInstance(zoneId, url);

            // 2) Create an instance of the the StudentPersonalProvider class
            // This class is responsible for publishing LearnerPersonal
            StudentPersonalProvider lpp = new StudentPersonalProvider();

            // The StudentPersonalProvider is allowed to provision itself with the zone
            lpp.Provision(zone);


            // 3) Connect to zones

            zone.Connect(AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None);

            // The StudentPersonalProvider will periodically send changes to the StudentPersonal
            // objects
            if (parameters["events"] != null)
            {
                lpp.StartEventProcessing(zone);
            }
        }
        /**
         * This method shows how to connect to zones and hook up a basic message handler
         * @param args
         */
        private void StartAgent( String[] args )
        {
            Initialize();
            NameValueCollection parameters = AdkExamples.parseCL( this, args );
            //    /url http://127.0.0.1:7080/test /zone test /pull /sourceID SimpleProvider
            String zoneId = parameters["zone"];
            String url = parameters["url"];

            if ( zoneId == null || url == null )
            {
                Console.WriteLine( "The /zone and /url parameters are required" );
                Environment.Exit( 0 );
            }

            // 1) Get an instance of the zone to connect to
            IZone zone = ZoneFactory.GetInstance( zoneId, url );

            // 2) Create an instance of the the StudentPersonalProvider class
            // This class is responsible for publishing LearnerPersonal
            StudentPersonalProvider lpp = new StudentPersonalProvider();
            // The StudentPersonalProvider is allowed to provision itself with the zone
            lpp.Provision( zone );

            // 3) Connect to zones

            zone.Connect( AdkExamples.Reg ? ProvisioningFlags.Register : ProvisioningFlags.None );

            // The StudentPersonalProvider will periodically send changes to the StudentPersonal
            // objects
            if ( parameters["events"] != null )
            {
                lpp.StartEventProcessing( zone );
            }
        }