/// <summary> /// The main constructor /// </summary> /// <param name="ARuntimeAction">Action to perform</param> /// <param name="APort">Port number to act on, where relevant</param> public ImmediateExecuteForm(ImmediateActions ARuntimeAction, int APort) { InitializeComponent(); _runtimeAction = ARuntimeAction; _port = APort; }
/// <summary> /// Parses the command line arguments /// </summary> /// <param name="args">The array of arguments passed to the main application program</param> public void ParseCommandLine(string[] args) { foreach (string arg in args) { if (arg.StartsWith("-op:")) { string command = arg.Substring(4).Trim().ToLower(); switch (command) { case "shutdownall": _immediateAction = ImmediateActions.ShutdownAll; break; case "shutdown": _immediateAction = ImmediateActions.Shutdown; break; case "start": _immediateAction = ImmediateActions.Start; break; case "stop": _immediateAction = ImmediateActions.Stop; break; } } else if (arg.StartsWith("-port:")) { int port; if (Int32.TryParse(arg.Substring(6), out port)) { _port = port; } } } _executeImmediateAction = IsValid; }