public int Run(IRDMPPlatformRepositoryServiceLocator repositoryLocator, IDataLoadEventListener listener, ICheckNotifier checkNotifier, GracefulCancellationToken token) { _activator = new ConsoleGuiActivator(repositoryLocator, checkNotifier); LogManager.DisableLogging(); if (options.UseSystemConsole) { Application.UseSystemConsole = true; } Application.Init(); var top = Application.Top; // Creates the top-level window to show var win = new ConsoleMainWindow(_activator); win.SetUp(top); try { Application.Run(); } catch (Exception e) { LogManager.EnableLogging(); LogManager.GetCurrentClassLogger().Error(e, "Application Crashed"); top.Running = false; return(-1); } return(0); }
public int Run(IRDMPPlatformRepositoryServiceLocator repositoryLocator, IDataLoadEventListener listener, ICheckNotifier checkNotifier, GracefulCancellationToken token) { _activator = new ConsoleGuiActivator(repositoryLocator, checkNotifier); LogManager.DisableLogging(); Application.Init(); var top = Application.Top; // Creates the top-level window to show var win = new Window("RDMP v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion) { X = 0, Y = 1, // Leave one row for the toplevel menu // By using Dim.Fill(), it will automatically resize without manual intervention Width = Dim.Fill(), Height = Dim.Fill() }; top.Add(win); // Creates a menubar, the item "New" has a help menu. var menu = new MenuBar(new MenuBarItem [] { new MenuBarItem("_File", new MenuItem [] { new MenuItem("_Open", "", Open), new MenuItem("Open _Tree", "", OpenTree), new MenuItem("_Run", "", Run), new MenuItem("Re_fresh", "", Refresh), new MenuItem("_Quit", "", () => { top.Running = false; }) }) }); top.Add(menu); top.Add(new Label("Press F9 for menu") { X = Pos.Center(), Y = Pos.Center() }); try { Application.Run(); } catch (Exception e) { _activator.ShowException("Application Crashed", e); top.Running = false; return(-1); } return(0); }
public ConsoleMainWindow(ConsoleGuiActivator activator) { _activator = activator; activator.Published += Activator_Published; activator.Emphasise += (s, e) => Show(e.Request.ObjectToEmphasise); }