예제 #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);
        }
예제 #2
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);
        }
예제 #3
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);
        }