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); }
public override void AttachTo(T backend) { #if PLATFORM_WINDOWS //TODO: after adding support for Windows, remove the ifdef in BitmapImageExtensions.cs throw new RecoverableException("Video analyzer is not supported on Windows."); #else base.AttachTo(backend); ApplicationExtensions.InvokeInUIThreadAndWait(() => OnAttach(backend)); #endif }
private void StopXwtThread() { lock (internalLock) { if (UiThreadId == -1) { return; } ApplicationExtensions.InvokeInUIThreadAndWait(Application.Exit); } }
public override void Show() { string tabName; if (!EmulationManager.Instance.CurrentEmulation.TryGetEmulationElementName(Backend.AnalyzableElement, out tabName)) { tabName = "?"; } ApplicationExtensions.InvokeInUIThreadAndWait(() => Emulator.UserInterfaceProvider.ShowAnalyser(this, tabName)); }
public void Close() { var w = window; if (w != null) { ApplicationExtensions.InvokeInUIThreadAndWait(() => { w.Hide(); }); w = null; return; } }
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); }
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); }
private static void ShowErrorWindow(string message) { var dialog = new Dialog(); dialog.Title = "Fatal error"; var markdown = new MarkdownView(); markdown.Markdown = message.Split(new [] { '\n' }).Select(x => "\t" + x).Aggregate((x, y) => x + "\n" + y); var copyButton = new Button("Copy to clipboard"); copyButton.Clicked += (sender, ev) => Clipboard.SetText(message); var box = new VBox(); box.PackStart(new Label("Got unhandled exception") { Font = global::Xwt.Drawing.Font.SystemFont.WithSize(15).WithWeight(Xwt.Drawing.FontWeight.Bold) }); box.PackStart(new ScrollView(markdown), true, true); box.PackStart(copyButton); dialog.Content = box; dialog.Buttons.Add(new DialogButton(Command.Ok)); dialog.Width = 350; dialog.Height = 300; var mre = new ManualResetEvent(false); ApplicationExtensions.InvokeInUIThread(() => { dialog.Run(); dialog.Dispose(); mre.Set(); }); mre.WaitOne(); }
public void Write(byte b) { BeforeWrite?.Invoke(b); ApplicationExtensions.InvokeInUIThread(() => utfDecoder.Feed(b)); }
public override void AttachTo(T backend) { base.AttachTo(backend); ApplicationExtensions.InvokeInUIThreadAndWait(() => OnAttach(backend)); }
public override void Hide() { ApplicationExtensions.InvokeInUIThreadAndWait(() => Emulator.UserInterfaceProvider.HideAnalyser(this)); }
public TerminalIOSource(Terminal terminal) { vt100decoder = new TermSharp.Vt100.Decoder(terminal, b => HandleInput(b), new TerminalToRenodeLogger(terminal)); utfDecoder = new ByteUtf8Decoder(x => ApplicationExtensions.InvokeInUIThread(() => vt100decoder.Feed(x))); }