private static void run() { using (var app = new AgniServiceApplication(SystemApplicationType.TestRig, new string[] {}, null)) { ((Agni.Identification.GDIDGenerator)app.GDIDProvider).TestingAuthorityNode = "sync://127.0.0.1:4000"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MenuForm()); } }
static void run(string[] args) { const string FROM = "AHGOV.Program"; using (var app = new AgniServiceApplication(SystemApplicationType.HostGovernor, args, null)) { try { var fromARD = app.CommandArgs[SysConsts.ARD_PARENT_CMD_PARAM].Exists; var updateProblem = app.CommandArgs[SysConsts.ARD_UPDATE_PROBLEM_CMD_PARAM].Exists; using (var governor = new HostGovernorService(fromARD, updateProblem)) { governor.Configure(null); governor.Start(); try { // WARNING: Do not modify what this program reads/writes from/to standard IO streams because // ARD uses those particular string messages for its protocol Console.WriteLine("OK."); //<-- ARD protocol, ARD waits for this token to assess startup situation ConsoleUtils.WriteMarkupContent(typeof(ProgramBody).GetText("Welcome.txt")); Console.WriteLine("Waiting for line to terminate..."); var abortableConsole = new TerminalUtils.AbortableLineReader(); try { while (app.Active && !governor.NeedsProcessRestart) { if (abortableConsole.Line != null) { app.Log.Write(new NFX.Log.Message { Type = NFX.Log.MessageType.Info, Topic = SysConsts.LOG_TOPIC_APP_MANAGEMENT, From = FROM, Text = "Main loop received CR|LF. Exiting..." }); break; //<-- ARD protocol, ARD sends a <CRLF> when it is time to shut down } Thread.Sleep(1000); } } finally { abortableConsole.Abort(); } } finally { governor.WaitForCompleteStop(); } }//using governor } catch (Exception error) { app.Log.Write(new NFX.Log.Message { Type = NFX.Log.MessageType.CatastrophicError, Topic = SysConsts.LOG_TOPIC_APP_MANAGEMENT, From = FROM, Text = "Exception leaked in run(): " + error.ToMessageWithType(), Exception = error }); throw error; } }//using APP }
static void run(string[] args) { const string FROM = "APH.Program"; using (var app = new AgniServiceApplication(SystemApplicationType.ProcessHost, args, null)) { try { using (var procHost = new ProcessControllerService(null)) { procHost.Configure(null); procHost.Start(); try { // WARNING: Do not modify what this program reads/writes from/to standard IO streams because // AHGOV uses those particular string messages for its protocol Console.WriteLine("OK."); //<-- AHGOV protocol, AHGOV waits for this token to assess startup situation ConsoleUtils.WriteMarkupContent(typeof(ProgramBody).GetText("Welcome.txt")); Console.WriteLine("Waiting for line to terminate..."); var abortableConsole = new TerminalUtils.AbortableLineReader(); try { while (app.Active) { if (abortableConsole.Line != null) { app.Log.Write(new NFX.Log.Message { Type = NFX.Log.MessageType.Info, Topic = Agni.SysConsts.LOG_TOPIC_WWW, From = FROM, Text = "Main loop received CR|LF. Exiting..." }); break; //<-- AHGOV protocol, AHGOV sends a <CRLF> when it is time to shut down } Thread.Sleep(1000); } } finally { abortableConsole.Abort(); } } finally { procHost.WaitForCompleteStop(); } } } catch (Exception error) { app.Log.Write(new NFX.Log.Message { Type = NFX.Log.MessageType.CatastrophicError, Topic = Agni.SysConsts.LOG_TOPIC_SVC, From = FROM, Text = "Exception leaked in run(): " + error.ToMessageWithType(), Exception = error }); throw error; } }//using app }