Ejemplo n.º 1
0
        private static bool OnConsoleCtrlMessage(CtrlTypes ctrlType)
        {
            ChoFramework.Shutdown();

            String message = "This message should never be seen!";

            // A switch to handle the event type.
            switch (ctrlType)
            {
            case CtrlTypes.CTRL_C_EVENT:
                message = "A CTRL_C_EVENT was raised by the user.";
                break;

            case CtrlTypes.CTRL_BREAK_EVENT:
                message = "A CTRL_BREAK_EVENT was raised by the user.";
                break;

            case CtrlTypes.CTRL_CLOSE_EVENT:
                message = "A CTRL_CLOSE_EVENT was raised by the user.";
                break;

            case CtrlTypes.CTRL_LOGOFF_EVENT:
                message = "A CTRL_LOGOFF_EVENT was raised by the user.";
                break;

            case CtrlTypes.CTRL_SHUTDOWN_EVENT:
                message = "A CTRL_SHUTDOWN_EVENT was raised by the user.";
                break;
            }

            throw new ChoConsoleCtrlException(message);
        }
Ejemplo n.º 2
0
        public ChoExprEvaluatorFrm(string contextInfo = null)
        {
            InitializeComponent();

            ChoFramework.Initialize();
            if (!contextInfo.IsNull())
            {
                txtContextInfo.Text = contextInfo;
            }
            txtHelp.Text = ChoPropertyManagerSettings.Me.GetHelpText();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// If we are presently showing a mainForm, clean it up.
        /// </summary>
        protected override void ExitThreadCore()
        {
            ChoFramework.Shutdown();

            if (_mainFormWindow != null)
            {
                // before we exit, give the main form a chance to clean itself up.
                _mainFormWindow.Close();
            }
            else
            {
                Environment.Exit(0);
            }
            base.ExitThreadCore();
        }
Ejemplo n.º 4
0
        public static void Run <T>(string[] args)
            where T : ChoApplicationHost
        {
            if (_applicationHost != null)
            {
                return;
            }

            lock (_hostLock)
            {
                if (_applicationHost == null)
                {
                    _applicationHost      = Activator.CreateInstance <T>();
                    _applicationHost.Args = args;
                    ChoApplicationHost.IsApplicationHostUsed = true;

                    ChoFramework.Initialize();
                    ChoService.Initialize();
                }
            }
        }
Ejemplo n.º 5
0
        public static void Run(ChoApplicationHost host, string[] args)
        {
            ChoGuard.ArgumentNotNull(host, "Host");

            if (_applicationHost != null)
            {
                return;
            }

            lock (_hostLock)
            {
                if (_applicationHost == null)
                {
                    _applicationHost      = host;
                    _applicationHost.Args = args;
                    ChoApplicationHost.IsApplicationHostUsed = true;

                    ChoFramework.Initialize();
                    ChoService.Initialize();
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// If we are presently showing a mainForm, clean it up.
        /// </summary>
        protected override void ExitThreadCore()
        {
            ChoWindowsManager.ShowConsoleWindow();

            ChoFramework.Shutdown();

            if (_mainFormWindow != null)
            {
                // before we exit, give the main form a chance to clean itself up.
                _mainFormWindow.Close();
            }
            else
            {
                Environment.Exit(0);
            }

            if (System.Windows.Application.Current != null)
            {
                System.Windows.Application.Current.Shutdown();
            }

            base.ExitThreadCore();
        }