Beispiel #1
0
        public bool TryOpen(string consoleName, out IIOSource ioSource)
        {
            TerminalWidget terminalWidget = null;

            ApplicationExtensions.InvokeInUIThreadAndWait(() =>
            {
                terminalWidget = new TerminalWidget(() => window.HasFocus);
            });
            ioSource = terminalWidget.IOSource;

            var mre = new ManualResetEventSlim();

            ApplicationExtensions.InvokeInUIThread(() =>
            {
                window                      = new Window();
                window.Title                = consoleName;
                window.Width                = 700;
                window.Height               = 400;
                window.Location             = WindowPositionProvider.Instance.GetNextPosition();
                window.Padding              = new WidgetSpacing();
                window.Content              = terminalWidget;
                terminalWidget.Initialized += mre.Set;
                window.Show();
                window.Closed += (sender, e) =>
                {
                    InnerOnClose();
                };
            });
            mre.Wait();

            return(true);
        }
Beispiel #2
0
        // isMonitorWindows is not used for ProcessBasedProvider
        public bool TryOpen(string consoleName, out IIOSource io, bool isMonitorWindow = false)
        {
            var ptyUnixStream = new PtyUnixStream();

            io = new StreamIOSource(ptyUnixStream);

            if (!CheckScreenTool())
            {
                process = null;
                return(false);
            }

            var commandString = $"{ScreenTool} {(ptyUnixStream.SlaveName)}";

            process = CreateProcess(consoleName, commandString);
            if (!RunProcess(process))
            {
                process = null;
                return(false);
            }

            // here we give 1s time for screen to start; otherwise some initial data (e.g. banner could be lost)
            Thread.Sleep(1000);
            return(true);
        }
Beispiel #3
0
        public bool TryOpen(string consoleName, out IIOSource io)
        {
            var ptyUnixStream = new PtyUnixStream();

            io = new StreamIOSource(ptyUnixStream);

            var commandString = string.Format("screen {0}", ptyUnixStream.SlaveName);

            process = CreateProcess(consoleName, commandString);
            if (!RunProcess(process))
            {
                process = null;
                return(false);
            }

            // here we give 1s time for screen to start; otherwise some initial data (e.g. banner could be lost)
            Thread.Sleep(1000);
            return(true);
        }
Beispiel #4
0
        public bool TryOpen(string consoleName, out IIOSource ioSource, bool isMonitorWindow = false)
        {
            TerminalWidget terminalWidget = null;

            ApplicationExtensions.InvokeInUIThreadAndWait(() =>
            {
                terminalWidget = new TerminalWidget(() => window.HasFocus, isMonitorWindow);
            });
            ioSource = terminalWidget.IOSource;

            var mre = new ManualResetEventSlim();

            ApplicationExtensions.InvokeInUIThread(() =>
            {
                window = new Window();
#if PLATFORM_WINDOWS
                window.Icon = Xwt.Drawing.Image.FromResource("renode_nobg.ico");
#endif
                window.Title = consoleName == null ? "Renode" : consoleName;
                // while these minimal values are not sane, we assume it's up to the user to decide
                window.Width                = ConfigurationManager.Instance.Get("termsharp", "window-width", 700, x => x >= 0);
                window.Height               = ConfigurationManager.Instance.Get("termsharp", "window-height", 400, x => x >= 0);
                var windowLocation          = WindowPositionProvider.Instance.GetNextPosition();
                window.Location             = windowLocation;
                window.Padding              = new WidgetSpacing();
                window.Content              = terminalWidget;
                terminalWidget.Initialized += mre.Set;
                window.Show();
                // window.Show() sets Location off screen if scaling > 100% on Windows
                window.Location = windowLocation;
                window.Closed  += (sender, e) =>
                {
                    InnerOnClose();
                };
            });
            mre.Wait();

            return(true);
        }
Beispiel #5
0
        public bool TryOpen(string consoleName, out IIOSource ioSource)
        {
            TerminalWidget terminalWidget = null;

            ApplicationExtensions.InvokeInUIThreadAndWait(() =>
            {
                terminalWidget = new TerminalWidget(() => window.HasFocus);
            });
            ioSource = terminalWidget.IOSource;

            var mre = new ManualResetEventSlim();

            ApplicationExtensions.InvokeInUIThread(() =>
            {
                window = new Window();
#if PLATFORM_WINDOWS
                window.Icon = Xwt.Drawing.Image.FromResource("renode_nobg.ico");
#endif
                window.Title                = consoleName == null ? "Renode" : consoleName;
                window.Width                = 700;
                window.Height               = 400;
                var windowLocation          = WindowPositionProvider.Instance.GetNextPosition();
                window.Location             = windowLocation;
                window.Padding              = new WidgetSpacing();
                window.Content              = terminalWidget;
                terminalWidget.Initialized += mre.Set;
                window.Show();
                // window.Show() sets Location off screen if scaling > 100% on Windows
                window.Location = windowLocation;
                window.Closed  += (sender, e) =>
                {
                    InnerOnClose();
                };
            });
            mre.Wait();

            return(true);
        }
Beispiel #6
0
 public ConsoleTerminal(IIOSource world)
 {
     multiplexer = new TerminalMultiplexer(world);
 }
Beispiel #7
0
 public ConsoleTerminal(IIOSource world)
 {
     multiplexer = new TerminalMultiplexer(world);
 }