Esempio n. 1
0
    public static void Main(string[] args) {
      #region Exception Sink Handlers
      // ---------------------------------------------------------------------

      // Add the event handler for handling UI thread exceptions to the event.
      Application.ThreadException += ThreadException;
      Application.ApplicationExit += (sender, eventArgs) => Terminal.Free();
      OnError += LogException;

      // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
      Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

      // Add the event handler for handling non-UI thread exceptions to the event. 
      AppDomain.CurrentDomain.UnhandledException += UnhandledException;

      // Setup hybrid compatability for Console mode.
      Terminal.Allocate();

      // ---------------------------------------------------------------------
      #endregion Exception Sink Handlers

      var p = new ShellSwitchParser(ref _sdData);
      if (!p.Parse(args))
        return;

      // Load configuration file data.
      // TODO
      // Display status
      // TODO



      var cmds = new Switchboard();

      // Establish an event handler to process key press events.
      Console.CancelKeyPress += CancelEventHandler;
      while (true) {
        // Start a console read operation.
        var line = Console.ReadLine();
        var kvp = cmds.ProcessCommand(line?.Trim());
        kvp.Key?.DynamicInvoke(kvp.Value);
      }
    }
Esempio n. 2
0
    public static void Main(string[] args) {
      #region Exception Sink Handlers
      // ---------------------------------------------------------------------

      // Add the event handler for handling UI thread exceptions to the event.
      Application.ThreadException += ThreadException;
      OnError += LogException;

      // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
      Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

      // Add the event handler for handling non-UI thread exceptions to the event. 
      AppDomain.CurrentDomain.UnhandledException += UnhandledException;

      // ---------------------------------------------------------------------
      #endregion Exception Sink Handlers

      var p = new ShellSwitchParser(ref _sdData);
      if (!p.Parse(args))
        return;

      // Load configuration file data.
      // TODO
      // Display status
      // TODO

      var cmds = new Switchboard();

      // Establish an event handler to process key press events.
      Console.CancelKeyPress += CancelEventHandler;
      while (true) {
        // Start a console read operation.
        var line = Console.ReadLine();

        cmds.Commands(line);
      }
    }