/// <summary> /// Run the agent as an application /// </summary> /// <example> /// Pull mode ///Debug Command line arguments: /zone test /url http://127.0.0.1:7080/test /pull /events true</example> /// <example> Push mode /// /zone test /url http://127.0.0.1:7080/test /push /port 10000 /events true</example> /// <param name="args"></param> public static void Main(String[] args) { SimpleProvider agent = null; try { if (args.Length < 2) { Console.WriteLine ("Usage: SimpleSubscriber /zone zone /url url [/full] [options]"); AdkExamples.printHelp(); return; } // Pre-parse the command-line before initializing the Adk Adk.Debug = AdkDebugFlags.None; AdkExamples.parseCL(null, args); // Initialize the Adk with the specified version, loading only the learner SDO package Adk.Initialize(AdkExamples.Version, SIFVariant.SIF_AU, (int)SdoLibraryType.Student); // Start the agent... agent = new SimpleProvider(); // Call StartAgent. This method does not return until the agent shuts down agent.StartAgent(args); // Wait for Ctrl-C to be pressed Console.WriteLine("Agent is running (Press Ctrl-C to stop)"); new AdkConsoleWait().WaitForExit(); } catch (Exception e) { Console.WriteLine(e); } finally { if (agent != null && agent.Initialized) { // Always shutdown the agent on exit try { agent.Shutdown (AdkExamples.Unreg ? ProvisioningFlags.Unprovide : ProvisioningFlags.None); } catch (AdkException adkEx) { Console.WriteLine(adkEx); } } } }
/// <summary> /// Run the agent as an application /// </summary> /// <example> /// Pull mode ///Debug Command line arguments: /zone test /url http://127.0.0.1:7080/test /pull /events true</example> /// <example> Push mode /// /zone test /url http://127.0.0.1:7080/test /push /port 10000 /events true</example> /// <param name="args"></param> public static void Main( String[] args ) { SimpleProvider agent = null; try { if ( args.Length < 2 ) { Console.WriteLine ( "Usage: SimpleSubscriber /zone zone /url url [/full] [options]" ); AdkExamples.printHelp(); return; } // Pre-parse the command-line before initializing the Adk Adk.Debug = AdkDebugFlags.None; AdkExamples.parseCL( null, args ); // Initialize the Adk with the specified version, loading only the learner SDO package Adk.Initialize( AdkExamples.Version, SIFVariant.SIF_AU, (int)SdoLibraryType.Student ); // Start the agent... agent = new SimpleProvider(); // Call StartAgent. This method does not return until the agent shuts down agent.StartAgent( args ); // Wait for Ctrl-C to be pressed Console.WriteLine( "Agent is running (Press Ctrl-C to stop)" ); new AdkConsoleWait().WaitForExit(); } catch ( Exception e ) { Console.WriteLine( e ); } finally { if ( agent != null && agent.Initialized ) { // Always shutdown the agent on exit try { agent.Shutdown ( AdkExamples.Unreg ? ProvisioningFlags.Unprovide : ProvisioningFlags.None ); } catch ( AdkException adkEx ) { Console.WriteLine( adkEx ); } } } }