Beispiel #1
0
        /// <summary>
        /// This shows the selection UI. Each time it is run, it calls Application.Init to reset everything.
        /// </summary>
        /// <returns></returns>
        private static Scenario GetScenarioToRun()
        {
            Application.UseSystemConsole = false;
            Application.Init();

            if (_menu == null)
            {
                Setup();
            }

            _top = Application.Top;

            _top.KeyDown += KeyDownHandler;

            _top.Add(_menu);
            _top.Add(_leftPane);
            _top.Add(_rightPane);
            _top.Add(_statusBar);

            _top.Ready += (o, a) => {
                if (_runningScenario != null)
                {
                    _top.SetFocus(_rightPane);
                    _runningScenario = null;
                }
            };

            Application.Run(_top, false);
            Application.Shutdown();
            return(_runningScenario);
        }
Beispiel #2
0
        public override void Setup()
        {
            Top = new Toplevel();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Quit", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_Simple Query...", "A simple query message box", () => MessageBox.Query(0, 6, "MessageBox.Query", "Minimum size was specified", "Ok")),
                new MenuBarItem("_Error Query...", "A error query message box", () => MessageBox.ErrorQuery(0, 6, "MessageBox.Query", "Minimum size was specified", "Ok")),
                // BUGBUG: Illustrates MessageBoxes do not deal with long text gracefully. Issue #432
                new MenuBarItem("_Long Text...", "Demo long text", () => MessageBox.Query(0, 6, "About UI Catalog", "This is a very long title. It is longer than the width of the screen. Will it Wrap? I bet  it will not wrap", "Ok")),
            });

            Top.Add(menu);

            Win = new Window($"Scenario: {GetName ()}")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };
            Top.Add(Win);
        }
Beispiel #3
0
    public static void ShowHex(Toplevel top)
    {
        var tframe = top.Frame;
        var ntop   = new Toplevel(tframe);
        var menu   = new MenuBar(new MenuBarItem [] {
            new MenuBarItem("_File", new MenuItem [] {
                new MenuItem("_Close", "", () => { Application.RequestStop(); }),
            }),
        });

        ntop.Add(menu);

        var win = new Window("/etc/passwd")
        {
            X      = 0,
            Y      = 1,
            Width  = Dim.Fill(),
            Height = Dim.Fill()
        };

        ntop.Add(win);

        var source = System.IO.File.OpenRead("/etc/passwd");
        var hex    = new HexView(source)
        {
            X      = 0,
            Y      = 0,
            Width  = Dim.Fill(),
            Height = Dim.Fill()
        };

        win.Add(hex);
        Application.Run(ntop);
    }
Beispiel #4
0
        public void FocusNearestView_Ensure_Focus_Ordered()
        {
            var top = new Toplevel();

            var win        = new Window();
            var winSubview = new View("WindowSubview")
            {
                CanFocus = true
            };

            win.Add(winSubview);
            top.Add(win);

            var frm        = new FrameView();
            var frmSubview = new View("FrameSubview")
            {
                CanFocus = true
            };

            frm.Add(frmSubview);
            top.Add(frm);

            top.ProcessKey(new KeyEvent(Key.Tab, new KeyModifiers()));
            Assert.Equal($"WindowSubview", top.MostFocused.Text);
            top.ProcessKey(new KeyEvent(Key.Tab, new KeyModifiers()));
            Assert.Equal("FrameSubview", top.MostFocused.Text);
            top.ProcessKey(new KeyEvent(Key.Tab, new KeyModifiers()));
            Assert.Equal($"WindowSubview", top.MostFocused.Text);

            top.ProcessKey(new KeyEvent(Key.BackTab | Key.ShiftMask, new KeyModifiers()));
            Assert.Equal("FrameSubview", top.MostFocused.Text);
            top.ProcessKey(new KeyEvent(Key.BackTab | Key.ShiftMask, new KeyModifiers()));
            Assert.Equal($"WindowSubview", top.MostFocused.Text);
        }
Beispiel #5
0
    //
    // Creates a nested editor
    static void Editor(Toplevel top)
    {
        var tframe = top.Frame;
        var ntop   = new Toplevel(tframe);
        var menu   = new MenuBar(new MenuBarItem [] {
            new MenuBarItem("_File", new MenuItem [] {
                new MenuItem("_Close", "", () => { Application.RequestStop(); }),
            }),
            new MenuBarItem("_Edit", new MenuItem [] {
                new MenuItem("_Copy", "", null),
                new MenuItem("C_ut", "", null),
                new MenuItem("_Paste", "", null)
            }),
        });

        ntop.Add(menu);

        var win = new Window(new Rect(0, 1, tframe.Width, tframe.Height - 1), "/etc/passwd");

        ntop.Add(win);

        var text = new TextView(new Rect(0, 0, tframe.Width - 2, tframe.Height - 3));

        text.Text = System.IO.File.ReadAllText("/etc/passwd");
        win.Add(text);

        Application.Run(ntop);
    }
Beispiel #6
0
        public override void Run()
        {
            var ntop = new Toplevel(new Rect(0, 0, Application.Driver.Cols, Application.Driver.Rows));

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Файл", new MenuItem [] {
                    new MenuItem("_Создать", "Creates new file", null),
                    new MenuItem("_Открыть", "", null),
                    new MenuItem("Со_хранить", "", null),
                    new MenuItem("_Выход", "", () => ntop.Running = false)
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            ntop.Add(menu);

            // BUGBUG: #437 This being commmented out causes menu to mis-behave
            var win = new Window($"Scenario: {GetName ()}")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            ntop.Add(win);

            base.Run();
        }
Beispiel #7
0
        public override void Setup()
        {
            Top = new Toplevel(new Rect(0, 0, Application.Driver.Cols, Application.Driver.Rows));
            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Файл", new MenuItem [] {
                    new MenuItem("_Создать", "Creates new file", null),
                    new MenuItem("_Открыть", "", null),
                    new MenuItem("Со_хранить", "", null),
                    new MenuItem("_Выход", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            Top.Add(menu);

            Win = new Window($"Scenario: {GetName ()}")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };
            Top.Add(Win);
        }
Beispiel #8
0
        public override void Init(Toplevel top, ColorScheme colorScheme)
        {
            Application.Init();
            Top = top;
            if (Top == null)
            {
                Top = Application.Top;
            }

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_New", "", () => New()),
                    new MenuItem("_Open", "", () => Open()),
                    new MenuItem("_Save", "", () => Save()),
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", () => Copy()),
                    new MenuItem("C_ut", "", () => Cut()),
                    new MenuItem("_Paste", "", () => Paste())
                }),
            });

            Top.Add(menu);

            var statusBar = new StatusBar(new StatusItem [] {
                new StatusItem(Key.F2, "~F2~ Open", () => Open()),
                new StatusItem(Key.F3, "~F3~ Save", () => Save()),
                new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
            });

            Top.Add(statusBar);

            CreateDemoFile(_fileName);

            Win = new Window(_fileName ?? "Untitled")
            {
                X           = 0,
                Y           = 1,
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = colorScheme,
            };
            Top.Add(Win);

            _textView = new TextView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            LoadFile();

            Win.Add(_textView);
        }
            public StagingUIController(DateTime?start, List <string> list)
            {
                top           = new Toplevel(Application.Top.Frame);
                top.KeyPress += (e) => {
                    // Prevents Ctrl+Q from closing this.
                    // Only Ctrl+C is allowed.
                    if (e.KeyEvent.Key == (Key.Q | Key.CtrlMask))
                    {
                        e.Handled = true;
                    }
                };

                bool Close()
                {
                    var n = MessageBox.Query(50, 7, "Close Window.", "Are you sure you want to close this window?", "Yes", "No");

                    return(n == 0);
                }

                var menu = new MenuBar(new MenuBarItem [] {
                    new MenuBarItem("_Stage", new MenuItem [] {
                        new MenuItem("_Close", "", () => { if (Close())
                                                           {
                                                               Application.RequestStop();
                                                           }
                                     }, null, null, Key.CtrlMask | Key.C)
                    })
                });

                top.Add(menu);

                var statusBar = new StatusBar(new [] {
                    new StatusItem(Key.CtrlMask | Key.C, "~^C~ Close", () => { if (Close())
                                                                               {
                                                                                   Application.RequestStop();
                                                                               }
                                   }),
                });

                top.Add(statusBar);

                Title       = $"Worker started at {start}.{start:fff}";
                ColorScheme = Colors.Base;

                Add(new ListView(list)
                {
                    X      = 0,
                    Y      = 0,
                    Width  = Dim.Fill(),
                    Height = Dim.Fill()
                });

                top.Add(this);
            }
Beispiel #10
0
 private void InitializeTopAndWindow(out Toplevel top, out Window window)
 {
     top    = Application.Top;
     window = new Window("FitApp")
     {
         X      = 0,
         Y      = 1,
         Width  = Dim.Fill(),
         Height = Dim.Fill()
     };
     top.Add(window);
     top.Add(this.appViews.StartScreen);
 }
Beispiel #11
0
        public static void OpenStartupPrograms(Toplevel top)
        {
            var tframe = top.Frame;
            var ntop   = new Toplevel(tframe);
            var menu   = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_Options", new MenuItem [] {
                    new MenuItem("_Go Back", "", () => { Application.RequestStop(); }),
                })
            });

            ntop.Add(menu);


            var win = new Window("Startup Programs")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            ntop.Add(win);

            var title = new Label(" - List of startup programs and their locations")
            {
                X = 1, Y = 1
            };

            win.Add(title);

            // Startup Programs Details
            StartupPrograms startupPrograms          = new StartupPrograms();
            var             startupProgramsNamesList = new ListView(startupPrograms.NamesList.ToArray())
            {
                X      = 0,
                Y      = 3,
                Width  = Dim.Percent(30),
                Height = Dim.Fill()
            };
            var startupProgramsLocationsList = new ListView(startupPrograms.LocationList.ToArray())
            {
                X = Pos.Right(startupProgramsNamesList), Y = 3, Width = Dim.Fill(), Height = Dim.Fill()
            };

            win.Add(startupProgramsNamesList);
            win.Add(startupProgramsLocationsList);

            Application.Run(ntop);
        }
Beispiel #12
0
        /// <summary>
        /// Design a field with label and text on same ligne
        /// </summary>
        /// <param name="ntop">View</param>
        /// <param name="textField">Object to retrieve value</param>
        /// <param name="caption">Label of field</param>
        /// <param name="text">Initial value</param>
        /// <param name="xCol">X pos for column</param>
        /// <param name="y">Line</param>
        public static void SetField(Toplevel ntop, ref TextView textField, String caption, String text, int xCol, int y, int height)
        {
            var f = new Label(caption)
            {
                X = 1, Y = y, TextAlignment = TextAlignment.Right, Width = xCol
            };

            ntop.Add(f);

            textField = new TextView()
            {
                X = xCol + +2, Y = y, Width = Dim.Fill() - 1, Text = text.Replace("\r", ""), Height = height, ColorScheme = Colors.Dialog
            };
            ntop.Add(textField);
        }
Beispiel #13
0
        /// <summary>
        /// Design a field with label and text on same ligne
        /// </summary>
        /// <param name="ntop">View</param>
        /// <param name="textField">Object to retrieve value</param>
        /// <param name="caption">Label of field</param>
        /// <param name="text">Initial value</param>
        /// <param name="xCol">X pos for column</param>
        /// <param name="y">Line</param>
        public static void SetField(Toplevel ntop, ref TextField textField, String caption, String text, int xCol, int y)
        {
            var f = new Label(caption)
            {
                X = 1, Y = y, TextAlignment = TextAlignment.Right, Width = xCol
            };

            ntop.Add(f);

            textField = new TextField(text.Replace("\r", ""))
            {
                X = xCol + +2, Y = y, Width = Dim.Fill() - 1
            };
            ntop.Add(textField);
        }
Beispiel #14
0
        public static void OpenIpDetails(Toplevel top)
        {
            var tframe = top.Frame;
            var ntop   = new Toplevel(tframe);
            var menu   = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_Options", new MenuItem [] {
                    new MenuItem("_Go Back", "", () => { Application.RequestStop(); }),
                })
            });

            ntop.Add(menu);


            var win = new Window("IP Details")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            ntop.Add(win);

            /*
             * IpDetails ipDetails = new IpDetails();
             * var labelDetails = new Label(ipDetails.GetIpDetails()) { X = 1, Y = 0 };
             * win.Add(labelDetails);
             */

            IpDetails ipDetails    = new IpDetails();
            var       labelDetails = new Label(ipDetails.GetIpDetails())
            {
                X = 1, Y = 0
            };

            var scrollView = new ScrollView(new Rect(1, 1, 100, 100))
            {
                ContentSize = new Size(100, 100),
                ShowVerticalScrollIndicator = true,
            };

            scrollView.Add(labelDetails);

            win.Add(scrollView);


            Application.Run(ntop);
        }
Beispiel #15
0
        public void ShowModal()
        {
            var ntop = new Toplevel();

            var statusBar = new StatusBar(new StatusItem[] {
                new StatusItem(Key.Enter, "~Enter~ Enter", onSelect),
                new StatusItem(Key.Esc, "~Esc~ Return", Quit)
            });

            ntop.Add(statusBar);
            ntop.StatusBar = statusBar;

            // Windows
            var win = new Window("Browse")
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 1
            };

            ntop.Add(win);

            info = new Label()
            {
                X             = 0,
                Y             = 0,
                Width         = Dim.Fill(),
                Height        = 1,
                TextAlignment = TextAlignment.Centered
            };
            info.Text = "Select a snapshot to see files";
            win.Add(info);

            tv = new TableView()
            {
                X             = 0,
                Y             = 1,
                Width         = Dim.Fill(),
                Height        = Dim.Fill(),
                FullRowSelect = true
            };
            win.Add(tv);
            ShowSnapshots();
            tv.CellActivated += onCellActivated;

            Application.Run(ntop);
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            try
            {
                InitializeLogging();
                IndyDotNet.Utils.Logger.Info("application started");

                Application.Init();
                Toplevel top = Application.Top;

                _mainWindow = new Window(new Rect(0, 1, top.Frame.Width, top.Frame.Height - 1), "IndyDotNet Command Line");
                top.Add(_mainWindow);

                MenuBar menu = new MenuBar(new MenuBarItem[]
                {
                    new MenuBarItem("_Application", new MenuItem []
                    {
                        new MenuItem("_Quit", "", () => { if (ConfirmQuit())
                                                          {
                                                              top.Running = false;
                                                          }
                                     })
                    }),
                    _poolHanlder.CreateMenu()
                });
                top.Add(menu);

                _mainWindow.Add(
                    _poolStatus,
                    _walletStatus,
                    _didStatus,
                    new Label(3, top.Frame.Height - 5, "Press ESC and 9 to activate the menubar"),
                    new Label(3, top.Frame.Height - 6, System.Reflection.Assembly.GetExecutingAssembly().CodeBase)
                    );

                Application.Run();
                IndyDotNet.Utils.Logger.Info("application ended");
            }
            catch (Exception ex)
            {
                string errorMessage = $"Fatal Exception kills process: {ex.Message}";
                // since this is a console app, force output to the console because the app is terminating anyways.
                // this will ensure users have a chance to see the error regardless of logging
                Console.WriteLine(errorMessage);
                // and follow through with logger, which could possible blow up :(
                IndyDotNet.Utils.Logger.Error(errorMessage);
            }
        }
Beispiel #17
0
    //
    // Creates a nested editor
    static void Editor(Toplevel top)
    {
        var tframe = top.Frame;
        var ntop   = new Toplevel(tframe);
        var menu   = new MenuBar(new MenuBarItem[] {
            new MenuBarItem("_File", new MenuItem [] {
                new MenuItem("_Close", "", () => { Application.RequestStop(); }),
            }),
            new MenuBarItem("_Edit", new MenuItem [] {
                new MenuItem("_Copy", "", null),
                new MenuItem("C_ut", "", null),
                new MenuItem("_Paste", "", null)
            }),
        });

        ntop.Add(menu);

        string fname = null;

        foreach (var s in new[] { "/etc/passwd", "c:\\windows\\win.ini" })
        {
            if (System.IO.File.Exists(s))
            {
                fname = s;
                break;
            }
        }

        var win = new Window(fname ?? "Untitled")
        {
            X      = 0,
            Y      = 1,
            Width  = Dim.Fill(),
            Height = Dim.Fill()
        };

        ntop.Add(win);

        var text = new TextView(new Rect(0, 0, tframe.Width - 2, tframe.Height - 3));

        if (fname != null)
        {
            text.Text = System.IO.File.ReadAllText(fname);
        }
        win.Add(text);

        Application.Run(ntop);
    }
Beispiel #18
0
        private void SetupStartScreenRegisterButtonAction(Toplevel top)
        {
            this.appViews.StartScreen.RegisterOptionButton.Clicked += () =>
            {
                //top.Remove(startScreen);

                // registerScreen = new RegisterView();
                //RegisterAction(userService, window, registerScreen,loginScreen);

                var regTop = new Toplevel(top.Frame);
                var win    = new Window("Register View")
                {
                    X      = 0,
                    Y      = 1,
                    Width  = Dim.Fill(),
                    Height = Dim.Fill()
                };

                regTop.Add(win);
                var quitLoginViewButtton = new Button(50, 0, "Go back");
                quitLoginViewButtton.Clicked += () => { regTop.Running = false; };

                win.Add(this.appViews.RegisterScreen);

                win.Add(quitLoginViewButtton);

                Application.Run(regTop);
            };
        }
        public override void Run()
        {
            Top?.Dispose();

            Top = new Toplevel(new Rect(0, 0, Application.Driver.Cols, Application.Driver.Rows));

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Файл", new MenuItem [] {
                    new MenuItem("_Создать", "Creates new file", null),
                    new MenuItem("_Открыть", "", null),
                    new MenuItem("Со_хранить", "", null),
                    new MenuItem("_Выход", "", () => Application.RequestStop())
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            Top.Add(menu);

            // BUGBUG: #437 This being commented out causes menu to mis-behave
            //var win = new Window ($"Scenario: {GetName ()}") {
            //	X = 0,
            //	Y = 1,
            //	Width = Dim.Fill (),
            //	Height = Dim.Fill ()
            //};
            //ntop.Add (win);

            base.Run();
        }
Beispiel #20
0
        public void CanFocus_Faced_With_Container()
        {
            var t = new Toplevel();
            var w = new Window();
            var f = new FrameView();
            var v = new View()
            {
                CanFocus = true
            };

            f.Add(v);
            w.Add(f);
            t.Add(w);

            Assert.True(t.CanFocus);
            Assert.True(w.CanFocus);
            Assert.True(f.CanFocus);
            Assert.True(v.CanFocus);

            f.CanFocus = false;
            Assert.False(f.CanFocus);
            Assert.True(v.CanFocus);

            v.CanFocus = false;
            Assert.False(f.CanFocus);
            Assert.False(v.CanFocus);

            v.CanFocus = true;
            Assert.False(f.CanFocus);
            Assert.True(v.CanFocus);
        }
Beispiel #21
0
        /// <summary>
        /// Design a field with label and text on same ligne
        /// </summary>
        /// <param name="ntop">View</param>
        /// <param name="textField">Object to retrieve value</param>
        /// <param name="caption">Label of field</param>
        /// <param name="text">Initial value</param>
        /// <param name="y">Line</param>
        public static void SetField(Toplevel ntop, TextField textField, String caption, String text, int y)
        {
            var f = new Label(caption)
            {
                X = 1, Y = y, TextAlignment = TextAlignment.Right
            };

            ntop.Add(f);

            var t = new TextField(text.Replace("\r", ""))
            {
                X = Pos.Right(f) + 1, Y = y, Width = Dim.Fill() - 1
            };

            ntop.Add(t);
        }
Beispiel #22
0
    private void AddMenuBar(Toplevel top)
    {
        var menu = new MenuBar(new MenuBarItem[]
        {
            new MenuBarItem("_File", new MenuItem[]
            {
                new MenuItem("Clone...", "Clone Repository", null),
                new MenuItem("_Open Repository...", "Open Repository", HandleOpenRepository),
                new MenuItem("_Exit", "", () =>
                {
                    if (Quit())
                    {
                        top.Running = false;
                    }
                })
            }),
            new MenuBarItem("_View", new MenuItem[]
            {
                new MenuItem("Show Uncommitted Changes", "", null),
            }),
            new MenuBarItem("_Repository", new MenuItem[]
            {
                new MenuItem("Refresh", "", null),
                new MenuItem("Fetch...", "", null),
                new MenuItem("Pull...", "", null),
                new MenuItem("Push...", "", null),
                new MenuItem("Save Stash...", "", null),
                new MenuItem("New Branch...", "", null),
                new MenuItem("Rebase Merge...", "", null),
            }),
        });

        top.Add(menu);
    }
Beispiel #23
0
        static void CreateUi()
        {
            _label    = CreateCenteredLabel();
            _topLevel = CreateTopLevel();
            _topLevel.Add(_label);

            _timeout = Application.MainLoop.AddTimeout(_updateInterval, UpdateTimer);
        }
Beispiel #24
0
        public void ShowModal(String message)
        {
            var ntop = new Toplevel();

            var statusBar = new StatusBar(new StatusItem[] {
                new StatusItem(Key.F1, "~F1~ Save", SaveSetup),
                new StatusItem(Key.Esc, "~Esc~ Return", () => { Quit(); })
            });

            ntop.Add(statusBar);
            ntop.StatusBar = statusBar;

            // Windows
            var win = new Window("Setup")
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 1
            };

            ntop.Add(win);

            var ms = new Label(message)
            {
                X           = 1,
                Y           = 1,
                Width       = Dim.Fill(),
                Height      = 2,
                ColorScheme = Colors.Error
            };

            ntop.Add(ms);

            Libs.ViewDesign.SetField(ntop, ref _repoPath, "Path to repository", Program.dataManager.config.RepoPath, 30, 5);
            Libs.ViewDesign.SetField(ntop, ref _repoPassword, "Repository password", Program.dataManager.config.GetRepoPassword(), 30, 6);
            Libs.ViewDesign.SetCheck(ntop, ref _useMasterPassword, "Use master password", Program.dataManager.config.UseMasterPassword, 30, 7);
            Libs.ViewDesign.SetCheck(ntop, ref _useVSS, "Windows Volume Shadow Copy (Admin mode needed)", Program.dataManager.config.UseVSS, 30, 8);
            Libs.ViewDesign.SetField(ntop, ref _restorePath, "Restore path", Program.dataManager.config.RestorePath, 30, 10);
            Libs.ViewDesign.SetField(ntop, ref _keepLast, "Purge, keep last", Program.dataManager.config.KeepLastSnapshots.ToString(), 30, 11);
            Libs.ViewDesign.SetField(ntop, ref _sourcePath, "Backup Paths", Program.dataManager.config.SourcesBackupPath, 30, 13, 5);

            //_sourcePath.
            _repoPassword.Secret = true;
            Application.Run(ntop);
        }
Beispiel #25
0
        static void Main(string[] args)
        {
            Application.Init();

            Toplevel top = Application.Top;
            var      win = new Window(new Rect(0, 1, top.Frame.Width, top.Frame.Height - 1), "Storage.Net CLI");

            top.Add(win);

            // Creates a menubar, the item "New" has a help menu.
            var menu = new MenuBar(new MenuBarItem[] {
                new MenuBarItem("_Storage", new MenuItem [] {
                    new MenuItem("_New", "Creates new file", SampleAction),
                    new MenuItem("_Close", "", () => Close()),
                    new MenuItem("_Quit", "", () => { if (Quit())
                                                      {
                                                          top.Running = false;
                                                      }
                                 })
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            top.Add(menu);

            // Add some controls
            win.Add(
                new Label(3, 2, "Login: "******""),
                new Label(3, 4, "Password: "******"")
            {
                Secret = true
            },
                new CheckBox(3, 6, "Remember me"),
                new RadioGroup(3, 8, new[] { "_Personal", "_Company" }),
                new Button(3, 14, "Ok"),
                new Button(10, 14, "Cancel"),
                new Label(3, 18, "Press ESC and 9 to activate the menubar"));

            Application.Run();
        }
        private JanelaPrincipal(Controlador controlador, Toplevel top)
            : base(new Rect(0, 1, top.Frame.Width, top.Frame.Height - 1), "Teste Programmers")
        {
            _controlador = controlador;
            top.Add(this);

            InicializarControles(top);
        }
Beispiel #27
0
        public void Init()
        {
            Toplevel top = Application.Top;

            MainWindow.Window = new Window(" { BRACES Cursed } ")
            {
                X      = 0,
                Y      = 1, // Leave one row for the toplevel menu
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            top.Add(MainWindow.Window);
            MainWindow.TopMenubar = new TopMenubar();
            top.Add(MainWindow.TopMenubar.MenuBar);
            MainWindow.TextEditor = new TextEditor();
            MainWindow.Window.Add(MainWindow.TextEditor.TextView);
        }
Beispiel #28
0
        public static void SetCheck(Toplevel ntop, ref CheckBox checkBox, String caption, bool value, int xCol, int y)
        {
            var f = new CheckBox(caption, value)
            {
                X = xCol + 2, Y = y
            };

            ntop.Add(f);
            checkBox = f;
        }
Beispiel #29
0
        public void ShowStaffMenu()
        {
            Application.Top.RemoveAll();
            _top = Application.Top;
            var staffMenuWindow = new StaffMenuWindow(null, user)
            {
                OnLogout = () =>
                {
                    MyController.Logout();
                    Application.RequestStop();
                },
            };

            _top.Add(staffMenuWindow);
            staffMenuWindow.OnSelect = (int value) =>
            {
                Application.RequestStop();
                Application.Top.Remove(staffMenuWindow);
                Debug.WriteLine(value);
                switch (value)
                {
                case 1:
                    ShowReservationList();
                    break;

                case 2:
                    ShowCarList();
                    break;

                case 3:
                    ShowModelManage();
                    break;

                case 4:
                    ShowMarkManage();
                    break;

                case 5:
                    ShowUserList();
                    break;

                case 6:
                    ShowAppSettings();
                    break;

                default:
                    break;
                }
            };
            staffMenuWindow.OnExit = () =>
            {
                Application.RequestStop();
            };
            Application.Run(_top);
        }
Beispiel #30
0
        Window SetupMemWindow(Toplevel top, List <string> buffer, string name, int offset, out ListView view)
        {
            var rect = GetMemWindowLayout(top, offset);
            var win  = new Window(rect, name);

            view = new ListView(buffer);

            top.Add(win);
            win.Add(view);
            return(win);
        }