Ejemplo n.º 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);

        string zoneId = parameters["zone"];
        string url    = parameters["url"];

        if (zoneId == null || url == null)
        {
            Console.WriteLine("The /zone and /url parameters are required");
            Console.Beep();
            throw new ArgumentException("The /zone and /url parameters are required");
        }

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

        // 2) Create an instance of the the LearnerPersonalHandler class
        // This class is responsible for dealing with events and responses
        // received that contain LearnerPersonal data objects
        LearnerPersonalHandler sdh = new LearnerPersonalHandler();

        // The LearnerPersonalHandler is allowed to provision itself with the zone
        sdh.provision(zone);

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

        // The LearnerPersonalHandler class has a sync() method, which it uses to
        // request data from the SIF zone
        sdh.sync(zone);
    }
Ejemplo n.º 2
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 );

        string zoneId = parameters[ "zone" ];
        string url = parameters[ "url" ];

        if( zoneId == null || url == null )
        {
            Console.WriteLine( "The /zone and /url parameters are required" );
            Console.Beep();
            throw new ArgumentException( "The /zone and /url parameters are required" );
        }

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

        // 2) Create an instance of the the LearnerPersonalHandler class
        // This class is responsible for dealing with events and responses
        // received that contain LearnerPersonal data objects
        LearnerPersonalHandler sdh = new LearnerPersonalHandler();
        // The LearnerPersonalHandler is allowed to provision itself with the zone
        sdh.provision( zone );

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

        // The LearnerPersonalHandler class has a sync() method, which it uses to
        // request data from the SIF zone
        sdh.sync( zone );
    }