コード例 #1
0
        static void Main(string[] args)
        {
            InitializeServiceProvider();

            IConsoleApp app = _serviceProvider.GetService <IConsoleApp>();

            app.Run();
        }
コード例 #2
0
        public void SetCurrentApplication(IConsoleApp app)
        {
            currentApp = app;

            if (currentApp.Console.Output is AppOutputStream console)
            {
                ConsoleManager.Controller.Active = console.Session;
            }
        }
コード例 #3
0
        public AppManager(ConsoleSession debug, IKeyboard keyboard, ServiceManager serviceManager)
        {
            this.ServiceManager = serviceManager;
            this.keyboard       = keyboard;
            this.debug          = debug;

            shell = new Shell();

            currentApp = shell;
        }
コード例 #4
0
ファイル: AppManager.cs プロジェクト: stjordanis/MOSA-Project
        public AppManager(ConsoleSession debug, IKeyboard keyboard)
        {
            this.keyboard = keyboard;

            this.debug = debug;

            shell = new Shell();

            currentApp = shell;
        }
コード例 #5
0
        public AppManager(ConsoleSession debug, IKeyboard keyboard)
        {
            this.keyboard = keyboard;

            this.debug = debug;

            shell = new Shell();

            currentApp = shell;
        }
コード例 #6
0
        public void SetCurrentApplication(IConsoleApp app)
        {
            currentApp = app;

            var console = currentApp.Console.Output as AppOutputStream;

            if (console != null)
            {
                ConsoleManager.Controller.Active = console.Session;
            }
        }
コード例 #7
0
        public void StartApp(IConsoleApp app, Stream input, Stream output, bool enableEcho, string parameters)
        {
            if (input == null)
            {
                input = new AppInputStream();
            }

            if (output == null)
            {
                var session = ConsoleManager.Controller.CreateSeason();

                output = new AppOutputStream(session);
            }

            app.Console.Input      = input;
            app.Console.Output     = output;
            app.Console.EnableEcho = enableEcho;
            app.AppManager         = this;

            SetCurrentApplication(app);

            app.Start(parameters);
        }
コード例 #8
0
ファイル: Console.cs プロジェクト: whitelava3203/EraTohoCv
        public static void Initialize()
        {
            /*
             * Application.EnableVisualStyles();
             * Application.SetCompatibleTextRenderingDefault(false);
             */
            ConsoleApp.ConsoleManager f = new ConsoleApp.ConsoleManager();
            Thread thread = new Thread(() =>
            {
                Application.Run(f);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();


            while (!f.Initialized)
            {
                Thread.Sleep(25);
            }

            consoleApp = f;
            return;
        }
コード例 #9
0
ファイル: BaCon.cs プロジェクト: jazmatician/BizArk3
        /// <summary>
        /// Creates a console object, fills it from the default command-line arguments, then calls its Start method. Also supports Click-Once deployed URL arguments.
        /// </summary>
        /// <param name="options">Options for how to handle running the console app.</param>
        public static void Start <T>(BaConStartOptions options = null) where T : IConsoleApp, new()
        {
            if (options == null)
            {
                options = new BaConStartOptions();
            }

            IConsoleApp consoleApp = null;

            try
            {
                var results = ParseArgs <T>(options.CmdLineOptions);
                consoleApp = results.Args;

                if (results.Title.HasValue())
                {
                    WriteLine(results.Title, Theme.AppTitleColor);
                }
                if (results.Description.HasValue())
                {
                    WriteLine(results.Description, Theme.AppDescriptionColor);
                }
                if (results.Copyright.HasValue())
                {
                    WriteLine(results.Copyright.Replace("©", "(c)"), Theme.AppDescriptionColor); // The © doesn't show up correctly in the console.
                }
                WriteLine();                                                                     // Put a line between the title and rest of the information.

                // Validate only after checking to see if they requested help
                // in order to prevent displaying errors when they request help.
                if (consoleApp.Help || results.Errors.Length > 0)
                {
                    WriteHelp(results);
                    if (!consoleApp.Help && results.Errors.Length > 0)
                    {
                        Environment.ExitCode = options.CmdLineOptions.InvalidArgsExitCode ?? 1;                         // There were errors, return exit code.
                    }
                    else
                    {
                        Environment.ExitCode = 0;
                    }
                    return;
                }

                Environment.ExitCode = consoleApp.Start();
            }
            catch (Exception ex)
            {
                if (consoleApp == null || !consoleApp.Error(ex))
                {
                    WriteError(ex);
                    Environment.ExitCode = options?.CmdLineOptions?.FatalErrorExitCode ?? -1;
                }
            }
            finally
            {
                if (consoleApp != null && consoleApp.Wait)
                {
                    WriteLine(options.PressAnyKey);
                    Console.ReadKey();
                }

                // Dispose of the app if it is disposable.
                (consoleApp as IDisposable)?.Dispose();
            }
        }
コード例 #10
0
ファイル: NgenLauncher.cs プロジェクト: slavagu/NgenWrapper
 private void RunNgen(string cmdLine)
 {
     _ngenApp = new ConsoleApp(NgenExePath, cmdLine);
     _ngenApp.ConsoleOutput += OnConsoleOutput;
     _ngenApp.Exited += OnConsoleExited;
     _ngenApp.Run();
 }
コード例 #11
0
ファイル: NgenLauncher.cs プロジェクト: slavagu/NgenWrapper
 private void DisposeNgen()
 {
     if (_ngenApp != null)
     {
         _ngenApp.ConsoleOutput -= OnConsoleOutput;
         _ngenApp.Exited -= OnConsoleExited;
         _ngenApp.Dispose();
         _ngenApp = null;
     }
 }
コード例 #12
0
 public ManualAddPortfolioCommand(ILogger logger, IConsoleApp consoleApp)
 {
     this.logger     = logger;
     this.consoleApp = consoleApp;
 }
コード例 #13
0
 public ManualAddClientCommand(ILogger logger, IConsoleApp consoleApp)
 {
     this.logger     = logger;
     this.consoleApp = consoleApp;
 }
コード例 #14
0
        public void StartApp(IConsoleApp app, Stream input, Stream output, bool enableEcho, string parameters)
        {
            if (input == null)
            {
                input = new AppInputStream();
            }

            if (output == null)
            {
                var session = Mosa.Kernel.x86.ConsoleManager.Controller.CreateSeason();

                output = new AppOutputStream(session);
            }

            app.Console.Input = input;
            app.Console.Output = output;
            app.Console.EnableEcho = enableEcho;
            app.AppManager = this;

            SetCurrentApplication(app);

            app.Start(parameters);
        }
コード例 #15
0
        public void SetCurrentApplication(IConsoleApp app)
        {
            currentApp = app;

            var console = currentApp.Console.Output as AppOutputStream;

            if (console != null)
            {
                ConsoleManager.Controller.Active = console.Session;
            }
        }