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)
    {
        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 LearnerPersonalProvider class
        // This class is responsible for publishing LearnerPersonal
        LearnerPersonalProvider lpp = new LearnerPersonalProvider();

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

        // 2) Create an instance of the the LearnerPersonalProvider class
        // This class is responsible for publishing LearnerPersonal
        WorkforcePersonalProvider wpp = new WorkforcePersonalProvider();

        // The LearnerPersonalProvider is allowed to provision itself with the zone

        wpp.provision(zone);

        // Connect
        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);

        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 LearnerPersonalProvider class
        // This class is responsible for publishing LearnerPersonal
        LearnerPersonalProvider lpp = new LearnerPersonalProvider();
        // The LearnerPersonalProvider is allowed to provision itself with the zone
        lpp.provision(zone);

        // 2) Create an instance of the the LearnerPersonalProvider class
        // This class is responsible for publishing LearnerPersonal
        WorkforcePersonalProvider wpp = new WorkforcePersonalProvider();
        // The LearnerPersonalProvider is allowed to provision itself with the zone

        wpp.provision(zone);

        // Connect
        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);
        }
    }