示例#1
0
 private void OpenTree()
 {
     try
     {
         var dlg = new ConsoleGuiSelectOne(_activator.CoreChildProvider);
         if (dlg.ShowDialog())
         {
             var edit = new ConsoleGuiTree(_activator, dlg.Selected);
             edit.ShowDialog();
         }
     }
     catch (Exception e)
     {
         _activator.ShowException("Unexpected error in open/edit tree", e);
     }
 }
示例#2
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);
        }