Пример #1
0
        public ShellDialog(GraphicalShell shell)
        {
            InitializeComponent();
            Icon = de.mastersign.shell.Properties.Resources.AppShell;
            shell.Exit += shell_Exit;
            shell.GraphicalShellControl = shellControl;
            shellControl.UseShell(shell);

            int pos = shell.Buffer.CursorPosition.Y -
                      shell.Buffer.WindowSize.Height;
            if (pos < 0) pos = 0;
            shell.Buffer.WindowPosition = new Coordinates(0, pos);
        }
Пример #2
0
        private static void Execute(string scriptFile)
        {
            shell = new GraphicalShell();
            shell.StartShell(new RunnerRunspaceConfigurationFactory());
            shell.MoveBufferWindowPosition(0, 0);

            var baobabProperties = new Hashtable();
            baobabProperties["OpenWindow"] = false;
            shell.SetVariable("BaobabShell", baobabProperties);

            var cmd = new CommandInfo(scriptFile, null) { WriteDecorations = true, LocalScope = true };
            shell.InvokeSync(cmd);

            var openWindow = baobabProperties["OpenWindow"] is bool
                ? (bool)baobabProperties["OpenWindow"]
                : false;

            var ui = (BaseUI)shell.Host.UI;
            if (openWindow || ui.WarningWritten || ui.ErrorWritten)
            {
                var form = new ShellDialog(shell);
                Application.Run(form);
            }
        }