public AppUnix() { Console.Title = "Delta Minus"; Driver.SetAttribute(ColorScheme.Focus); ColorAttributes.SetColor(Program.prefs.theme); Application.Init(); Application.UseSystemConsole = true; AutoSize = true; _top = Application.Top; _top.ColorScheme.Normal = ColorAttributes.Current.baseColor; _top.ColorScheme.Focus = ColorAttributes.Current.baseColor; run(); Application.Run(); }
public override void Init(Toplevel top) { Application.Init(); Top = top; Win = new TestWindow($"CTRL-Q to Close - Scenario: {GetName ()}") { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; Top.Add(Win); }
private void InitilizeWindow() { Top = Application.Top; Top.ColorScheme = Styles.MainWindowScheme; Win = new Window("Grimoire") { X = 0, Y = 1, ColorScheme = Styles.MainWindowScheme, Width = Dim.Fill(), Height = Dim.Fill() }; Top.Add(Win); }
private static void AddArguments(Type paramType, List <object> pTypes) { if (paramType == typeof(Rect)) { pTypes.Add(Rect.Empty); } else if (paramType == typeof(NStack.ustring)) { pTypes.Add(NStack.ustring.Empty); } else if (paramType == typeof(int)) { pTypes.Add(0); } else if (paramType == typeof(bool)) { pTypes.Add(true); } else if (paramType.Name == "IList") { pTypes.Add(new List <object> ()); } else if (paramType.Name == "View") { var top = new Toplevel(); var view = new View(); top.Add(view); pTypes.Add(view); } else if (paramType.Name == "View[]") { pTypes.Add(new View [] { }); } else if (paramType.Name == "Stream") { pTypes.Add(new MemoryStream()); } else if (paramType.Name == "String") { pTypes.Add(string.Empty); } else if (paramType.Name == "TreeView`1[T]") { pTypes.Add(string.Empty); } else { pTypes.Add(null); } }
public void Constructor_Default() { var top = new Toplevel(); Assert.Equal(Colors.TopLevel, top.ColorScheme); Assert.Equal("Dim.Fill(margin=0)", top.Width.ToString()); Assert.Equal("Dim.Fill(margin=0)", top.Height.ToString()); Assert.False(top.Running); Assert.False(top.Modal); Assert.Null(top.MenuBar); Assert.Null(top.StatusBar); Assert.False(top.IsMdiContainer); Assert.False(top.IsMdiChild); }
public void ShowMainMenu() { Application.Top.RemoveAll(); _top = Application.Top; var mainMenuWindow = new MainMenuWindow(null, user) { OnLogout = () => { MyController.Logout(); Application.RequestStop(); }, }; _top.Add(mainMenuWindow); mainMenuWindow.OnSelect = (int value) => { Application.RequestStop(); Application.Top.Remove(mainMenuWindow); switch (value) { case 1: ShowCarList(); break; case 2: ShowReservationWindow(null); break; case 3: ShowUserReservationList(); break; case 4: ShowUserSettings(); break; case 5: ShowAppSettings(); break; default: break; } }; mainMenuWindow.OnExit = () => { Application.RequestStop(); }; Application.Run(_top); }
public void Start() { //Application.UseSystemConsole; Application.Init(); InitWindow(); var top = new Toplevel(window.Frame); top.Add(window); //top.Add(new Window() { X = 0, Y = 0, Width = 5, Height = 10 }); Application.Run(top); }
private void AddUnStagedWindow(Toplevel top) { _unStagedWindow = new Window("unstaged") { X = Pos.Right(_workspaceWindow), Y = 1, Width = Dim.Percent(30), Height = Dim.Fill() }; top.Add(_unStagedWindow); var unStagedTreeView = new TreeView() { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; var scrollView = new ScrollView() { KeepContentAlwaysInViewport = true, ShowVerticalScrollIndicator = true, ShowHorizontalScrollIndicator = true, ContentSize = new Size(200, 150), X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; scrollView.Add(unStagedTreeView); _unStagedWindow.Add(scrollView); //_unStagedWindow.Add(unStagedTreeView); _gitRepoInfo.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(_gitRepoInfo.Status)) { unStagedTreeView.ClearObjects(); unStagedTreeView.AddObjects(_gitRepoInfo.Status.Value.Select(x => new TreeItem() { Text = x.FilePath })); //unStagedTreeView.SetNeedsDisplay(); //scrollView.SetNeedsDisplay(); } }; }
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); }
public void RunState_Dispose_Cleans_Up () { var rs = new Application.RunState (null); Assert.NotNull (rs); // Should not throw because Toplevel was null rs.Dispose (); var top = new Toplevel (); rs = new Application.RunState (top); Assert.NotNull (rs); // Should throw because there's no stack Assert.Throws<InvalidOperationException> (() => rs.Dispose ()); }
/// <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); }
Rect GetSrcWindowLayout(Toplevel top) { int mid_y = top.Frame.Height / 4; int mid_x = top.Frame.Width / 3; switch (layout) { case Layout.WIDE: return(new Rect(0, 1, top.Frame.Width, mid_y * 2)); case Layout.TINY: return(new Rect(0, 1, mid_x * 2, mid_y * 2)); default: case Layout.TALL: return(new Rect(0, 1, mid_x * 2, mid_y * 3 + 2)); } }
/// <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); }
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); } }
// // 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); }
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); }
static void Main(string[] args) { Application.Init(); Top = Application.Top; Login loginView = new Login() { Controller = new LoginController(Top) }; loginView.Show(Top); Application.Run(); }
private static Window AddTopLevelWindow(Toplevel topLevel) { var window = new Window("All My Bricks Database Seeder") { X = 0, Y = 1, Width = Dim.Fill(), Height = Dim.Fill() }; topLevel.Add( window ); return(window); }
private static void AddMenuBar(Toplevel topLevel, Window window) { MenuBar = new MenuBar(new MenuBarItem[] { new MenuBarItem("_File", new MenuItem[] { new MenuItem("E_xit", "", () => topLevel.Running &= !CanExit) }) }); UpdateSynchronizationMenuView(window); topLevel.Add( MenuBar ); }
/// <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); }
public void Init() { Application.Init(); Application.UseSystemConsole = true; top = Application.Top; modeText = new Label(modes[0].ToString()); shuffle = false; LibVLCSharp.Shared.Core.Initialize(); _libVLC = new LibVLCSharp.Shared.LibVLC("-I", "null"); mp = new MediaPlayer(_libVLC); mp.TimeChanged += mp_TimeChanged; playList = new List<string>(); }
public Toplevel Top() { var top = new Toplevel() { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; bool okpressed = false; var ok = new Button(3, 14, "Ok") { Clicked = () => { Application.RequestStop(); okpressed = true; } }; var cancel = new Button(10, 14, "Cancel") { Clicked = Application.RequestStop }; var dialog = new Dialog("Login", 60, 18, ok, cancel); var name = new Label(1, 1, "Name:"); var entry = new TextField("Some Text field") { X = 1, Y = 2, Width = Dim.Fill(), Height = 1 }; dialog.Add(entry, name); Application.Run(dialog); if (okpressed) { PrintResult(entry.Text); Program.Start(); } return(top); }
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); }
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(); }
public UI() { Application.Init(); TopView = new Toplevel() { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; var menu = new MenuBar(new[] { new MenuBarItem("_File", new[] { new MenuItem("_Close", "", Application.RequestStop) }) }); var window1 = new Window("Window1") { X = 0, Y = Pos.Bottom(menu), Width = Dim.Percent(50), Height = Dim.Fill(), }; window1.Add(new ListView(new[] { "foo", "bar", "baz" }) { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill(), CanFocus = true }); var window2 = new Window("Window2") { X = Pos.Right(window1), Y = Pos.Bottom(menu), Width = Dim.Fill(), Height = Dim.Fill() }; TopView.Add(menu, window1, window2); }
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); }
public override void Init(Toplevel top) { Application.Init(); Top = top; if (Top == null) { Top = Application.Top; } //Win = new Window ($"CTRL-Q to Close - Scenario: {GetName ()}") { // X = 0, // Y = 0, // Width = Dim.Fill (), // Height = Dim.Fill () //}; //Top.Add (Win); }
public override void Init(Toplevel top, ColorScheme colorScheme) { Application.Init(); Top = top; if (Top == null) { Top = Application.Top; } Top.ColorScheme = Colors.Base; //Win = new TopLevel($"CTRL-Q to Close - Scenario: {GetName ()}") { // X = 0, // Y = 0, // Width = Dim.Fill (), // Height = Dim.Fill () //}; //Top.Add (Win); }
/// <summary> /// Helper that provides the default <see cref="Terminal.Gui.Window"/> implementation with a frame and /// label showing the name of the <see cref="Scenario"/> and logic to exit back to /// the Scenario picker UI. /// Override <see cref="Init(Toplevel)"/> to provide any <see cref="Terminal.Gui.Toplevel"/> behavior needed. /// </summary> /// <param name="top"></param> /// <remarks> /// <para> /// Thg base implementation calls <see cref="Application.Init"/>, sets <see cref="Top"/> to the passed in <see cref="Toplevel"/>, creates a <see cref="Window"/> for <see cref="Win"/> and adds it to <see cref="Top"/>. /// </para> /// <para> /// Overrides that do not call the base.<see cref="Run"/>, must call <see cref="Application.Init "/> before creating any views or calling other Terminal.Gui APIs. /// </para> /// </remarks> public virtual void Init(Toplevel top) { Application.Init(); Top = top; if (Top == null) { Top = Application.Top; } Win = new Window($"CTRL-Q to Close - Scenario: {GetName ()}") { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; Top.Add(Win); }