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);
        }
        public static Window renderList()
        {
            var list = new Window("List")
            {
                X      = 0,
                Y      = 1,
                Width  = 40,
                Height = Dim.Fill()
            };

            list.Add(
                new ListView(new Rect(1, 1, 20, 20), listSchools())
                );;

            return(list);
        }
 public GridViewColumn(string name)
 {
     _width   = name.Length;
     Height   = Dim.Fill();
     Width    = _width;
     _divider = new Label(string.Empty.PadLeft(name.Length, DividerChar))
     {
         Width = Dim.Fill(),
         Y     = Pos.Y(this) + 1
     };
     Add(new Label(name)
     {
         Y = Pos.Y(this)
     });
     Add(_divider);
 }
Exemple #4
0
        public override void Setup()
        {
            //Top.LayoutStyle = LayoutStyle.Computed;
            // Demonstrate using Dim to create a horizontal ruler that always measures the parent window's width
            // BUGBUG: Dim.Fill returns too big a value sometimes.
            const string rule            = "|123456789";
            var          horizontalRuler = new Label("")
            {
                X           = 0,
                Y           = 0,
                Width       = Dim.Fill(1),             // BUGBUG: I don't think this should be needed; DimFill() should respect container's frame. X does.
                ColorScheme = Colors.Error
            };

            Application.Resized += (sender, a) => {
                horizontalRuler.Text = rule.Repeat((int)Math.Ceiling((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
Exemple #5
0
        public static Window Render()
        {
            var Win = new Window("Punto de venta")
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 1
            };

            Label message = new Label(1, 1, "Sistema de punto de venta desarrollado por joel bugarini");

            Win.Add(message);

            return(Win);
        }
Exemple #6
0
        private void OpenReport(string path, Action <Exception> exceptionHandler)
        {
            if (path == null)
            {
                return;
            }

            var cts = new CancellationTokenSource();

            var    btn        = new Button("Cancel");
            Action cancelFunc = () => { cts.Cancel(); };
            Action closeFunc  = () => { Application.RequestStop(); };

            btn.Clicked += cancelFunc;

            var dlg  = new Dialog("Opening", MainWindow.DlgWidth, 5, btn);
            var rows = new Label($"Loaded: 0 rows")
            {
                Width = Dim.Fill()
            };

            dlg.Add(rows);

            Task.Run(() => {
                try
                {
                    CurrentReport = new ReportReader(new FileInfo(path), (s) =>
                                                     rows.Text = $"Loaded: {s:N0} rows", cts.Token);
                    SetupToShow(CurrentReport.Failures.FirstOrDefault());
                    Next();
                }
                catch (Exception e)
                {
                    exceptionHandler(e);
                }
            }
                     ).ContinueWith((t) => {
                btn.Clicked -= cancelFunc;
                btn.Text     = "Done";
                btn.Clicked += closeFunc;
                dlg.SetNeedsDisplay();

                cts.Dispose();
            });

            Application.Run(dlg);
        }
Exemple #7
0
        public static void Init()
        {
            Application.Init();
            DarkScheme = new ColorScheme()
            {
                Normal    = Terminal.Gui.Attribute.Make(Color.Black, Color.Gray),
                Disabled  = Terminal.Gui.Attribute.Make(Color.Black, Color.Gray),
                HotFocus  = Terminal.Gui.Attribute.Make(Color.Black, Color.Gray),
                HotNormal = Terminal.Gui.Attribute.Make(Color.Black, Color.Gray),
            };
            var Top = Application.Top;

            FirmwareWin = new Window("Firmware")
            {
                X           = 0,
                Y           = 1,
                Width       = Dim.Percent(50),
                Height      = Dim.Fill(),
                ColorScheme = DarkScheme,
            };

            InfoWin = new Window("Info")
            {
                X           = Pos.Right(FirmwareWin),
                Y           = 1,
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = DarkScheme,
            };

            Menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("Tools/Settings", new MenuItem [] {
                    new MenuItem("Open New FW", "Opens a new fw dir", OpenNewDir),
                    new MenuItem("Extract All", "", null),
                    new MenuItem("Quit", "", Application.RequestStop),
                }),
            })
            {
                ColorScheme = DarkScheme,
            };


            Top.Add(FirmwareWin);
            Top.Add(InfoWin);
            Top.Add(Menu);
            Application.Run();
        }
Exemple #8
0
        public PeersApp() : base("Peers")
        {
            string[] urls = { DefaultUrl };

            var logger            = LimboLogs.Instance;
            var serializer        = new EthereumJsonSerializer();
            var httpClient        = new HttpClient();
            var defaultHttpClient = new DefaultHttpClient(httpClient, serializer, logger, int.MaxValue);
            var proxy             = new JsonRpcClientProxy(defaultHttpClient, urls, logger);

            _adminRpc = new AdminJsonRpcClientProxy(proxy);

            MenuBar menu = new MenuBar(new MenuBarItem[]
            {
                new MenuBarItem("_File", new MenuItem[]
                {
                    new MenuItem("_Quit", "", () => { Application.RequestStop(); })
                }),
            });

            ListView view = new ListView()
            {
                X      = 0,
                Y      = 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill() - 1,
            };

            view.AllowsAll();

            Add(menu, view);

            bool UpdateTimer(MainLoop mainLoop)
            {
                _adminRpc.admin_peers(true).ContinueWith(
                    t => Application.MainLoop.Invoke(() =>
                {
                    Title = $"Last Peers Update {DateTime.Now}";
                    view.SetSourceAsync(t.Result.Result.Select(ToPeerInfoRow).OrderByDescending(r => r.Reputation).ToArray());
                })
                    );

                return(true);
            }

            var token = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(10), UpdateTimer);
        }
Exemple #9
0
    static void ListSelectionDemo()
    {
        var d = new Dialog("Selection Demo", 60, 20,
                           new Button("Ok", is_default: true)
        {
            Clicked = () => { Application.RequestStop(); }
        },
                           new Button("Cancel")
        {
            Clicked = () => { Application.RequestStop(); }
        });

        var animals = new List <string>()
        {
            "Alpaca", "Llama", "Lion", "Shark", "Goat"
        };
        var msg = new Label("Use space bar or control-t to toggle selection")
        {
            X      = 1,
            Y      = 1,
            Width  = Dim.Fill() - 1,
            Height = 1
        };

        var list = new ListView(animals)
        {
            X             = 1,
            Y             = 3,
            Width         = Dim.Fill() - 4,
            Height        = Dim.Fill() - 4,
            AllowsMarking = true
        };

        d.Add(msg, list);
        Application.Run(d);

        var result = "";

        for (int i = 0; i < animals.Count; i++)
        {
            if (list.Source.IsMarked(i))
            {
                result += animals[i] + " ";
            }
        }
        MessageBox.Query(60, 10, "Selected Animals", result == "" ? "No animals selected" : result, "Ok");
    }
Exemple #10
0
        public override void Setup()
        {
            var charMap = new CharMap()
            {
                X           = 0, Y = 0, Width = CharMap.RowWidth + 2, Height = Dim.Fill(), Start = 0x2500,
                ColorScheme = Colors.Dialog
            };

            Win.Add(charMap);

            Button CreateBlock(Window win, ustring title, int start, int end, View align)
            {
                var button = new Button($"{title} (U+{start:x5}-{end:x5})")
                {
                    X       = Pos.X(align),
                    Y       = Pos.Bottom(align),
                    Clicked = () => {
                        charMap.Start = start;
                    },
                };

                win.Add(button);
                return(button);
            };

            var label = new Label("Unicode Blocks:")
            {
                X = Pos.Right(charMap) + 2, Y = Pos.Y(charMap)
            };

            Win.Add(label);
            var button = CreateBlock(Win, "Currency Symbols", 0x20A0, 0x20CF, label);

            button = CreateBlock(Win, "Letterlike Symbols", 0x2100, 0x214F, button);
            button = CreateBlock(Win, "Arrows", 0x2190, 0x21ff, button);
            button = CreateBlock(Win, "Mathematical symbols", 0x2200, 0x22ff, button);
            button = CreateBlock(Win, "Miscellaneous Technical", 0x2300, 0x23ff, button);
            button = CreateBlock(Win, "Box Drawing & Geometric Shapes", 0x2500, 0x25ff, button);
            button = CreateBlock(Win, "Miscellaneous Symbols", 0x2600, 0x26ff, button);
            button = CreateBlock(Win, "Dingbats", 0x2700, 0x27ff, button);
            button = CreateBlock(Win, "Braille", 0x2800, 0x28ff, button);
            button = CreateBlock(Win, "Miscellaneous Symbols and Arrows", 0x2b00, 0x2bff, button);
            button = CreateBlock(Win, "Alphabetic Presentation Forms", 0xFB00, 0xFb4f, button);
            button = CreateBlock(Win, "Cuneiform Numbers and Punctuation[1", 0x12400, 0x1240f, button);
            button = CreateBlock(Win, "Chess Symbols", 0x1FA00, 0x1FA0f, button);
            button = CreateBlock(Win, "End", CharMap.MaxCodePointVal - 16, CharMap.MaxCodePointVal, button);
        }
Exemple #11
0
        public void Init(string path)
        {
            var dbOnTheRocks         = new PaymentClaimsRocksDb(path, new DbConfig(), LimboLogs.Instance);
            var paymentClaimsBytes   = dbOnTheRocks.GetAll();
            var paymentClaimsDecoder = new PaymentClaimDecoder();
            var paymentClaims        = paymentClaimsBytes
                                       .Select(b => paymentClaimsDecoder.Decode(b.Value.AsRlpStream()));

            var window = new Window("Payment claims")
            {
                X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
            };

            if (!paymentClaims.Any())
            {
                MessageBox.Query(40, 7, "Payment claims", "No data." +
                                 $"{Environment.NewLine}(ESC to close)");
                window.FocusPrev();
                return;
            }

            var y = 1;

            foreach (var paymentClaim in paymentClaims)
            {
                var paymentClaimBtn = new Button(1, y++, $"AssetName: {paymentClaim.AssetName}," +
                                                 $"DepositId: {paymentClaim.DepositId}");

                paymentClaimBtn.Clicked = () =>
                {
                    var paymentClaimsDetailsWindow = new Window("Payment claim details")
                    {
                        X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
                    };
                    Application.Top.Add(paymentClaimsDetailsWindow);

                    var serializer      = new EthereumJsonSerializer();
                    var paymentClaimLbl = new Label(1, 1, serializer.Serialize(paymentClaim, true));
                    paymentClaimsDetailsWindow.Add(paymentClaimLbl);
                    Application.Run(paymentClaimsDetailsWindow);
                };
                window.Add(paymentClaimBtn);
            }

            Application.Top.Add(window);
            Application.Run(window);
        }
Exemple #12
0
        private void AddFilter(Window win)
        {
            _filterLabel = new Label(FILTER_LABEL)
            {
                X = MARGIN_LEFT
            };

            _filterField = new TextField(string.Empty)
            {
                X        = Pos.Right(_filterLabel) + 1,
                Y        = Pos.Top(_filterLabel),
                CanFocus = true,
                Width    = Dim.Fill() - _filterLabel.Text.Length
            };

            var filterErrorLabel = new Label(string.Empty)
            {
                X           = Pos.Right(_filterLabel) + 1,
                Y           = Pos.Top(_filterLabel) + 1,
                ColorScheme = Colors.Base,
                Width       = Dim.Fill() - _filterLabel.Text.Length
            };

            _filterField.TextChanged += (str) =>
            {
                // str is the OLD value
                string filterText = _filterField.Text?.ToString();
                try
                {
                    filterErrorLabel.Text        = " ";
                    filterErrorLabel.ColorScheme = Colors.Base;
                    filterErrorLabel.Redraw(filterErrorLabel.Bounds);

                    List <GridViewRow> itemList = GridViewHelpers.FilterData(_itemSource.GridViewRowList, filterText);
                    _listView.Source = new GridViewDataSource(itemList);
                }
                catch (Exception ex)
                {
                    filterErrorLabel.Text        = ex.Message;
                    filterErrorLabel.ColorScheme = Colors.Error;
                    filterErrorLabel.Redraw(filterErrorLabel.Bounds);
                    _listView.Source = _itemSource;
                }
            };

            win.Add(_filterLabel, _filterField, filterErrorLabel);
        }
        public void Init(string path)
        {
            var dbOnTheRocks = new BlocksRocksDb(path, new DbConfig(), LimboLogs.Instance);
            var blocksBytes  = dbOnTheRocks.GetAll();
            var blockDecoder = new BlockDecoder();
            var blocks       = blocksBytes
                               .Select(b => blockDecoder.Decode(b.Value.AsRlpStream()))
                               .OrderBy(b => b.Number)
                               .ToList();

            var window = new Window("Blocks")
            {
                X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
            };

            if (!blocks.Any())
            {
                MessageBox.Query(40, 7, "Info", "No data.");
                window.FocusPrev();
                return;
            }

            var y = 1;

            foreach (var block in blocks)
            {
                var blockBtn = new Button(1, y++, $"Number: {block.Number}, Hash: {block.Hash}");


                blockBtn.Clicked = () =>
                {
                    var blockDetailsWindow = new Window("Block details")
                    {
                        X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
                    };
                    Application.Top.Add(blockDetailsWindow);
                    var serializer = new EthereumJsonSerializer();
                    var blockLbl   = new Label(1, 1, serializer.Serialize(block, true));
                    blockDetailsWindow.Add(blockLbl);
                    Application.Run(blockDetailsWindow);
                };
                window.Add(blockBtn);
            }

            Application.Top.Add(window);
            Application.Run(window);
        }
Exemple #14
0
    static void Main()
    {
        //Application.UseSystemConsole = true;
        Application.Init();

        var top    = Application.Top;
        var tframe = top.Frame;

        var win = new Window("Hello")
        {
            X      = 0,
            Y      = 1,
            Width  = Dim.Fill(),
            Height = Dim.Fill() - 1
        };
        var menu = new MenuBar(new MenuBarItem [] {
            new MenuBarItem("_File", new MenuItem [] {
                new MenuItem("_New", "Creates new file", NewFile),
                new MenuItem("_Open", "", null),
                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)
            })
        });

        ShowEntries(win);
        int count = 0;

        ml = new Label(new Rect(3, 17, 47, 1), "Mouse: ");
        Application.RootMouseEvent += delegate(MouseEvent me) {
            ml.Text = $"Mouse: ({me.X},{me.Y}) - {me.Flags} {count++}";
        };

        win.Add(ml);

        top.Add(win, menu);
        top.Add(menu);
        Application.Run();
    }
Exemple #15
0
        public override void Setup()
        {
#if true
            string txt = "Hello world, how are you today? Pretty neat!";
#else
            string txt = "Hello world, how are you today? Unicode:  ~  gui.cs  . Neat?";
#endif
            var alignments = Enum.GetValues(typeof(Terminal.Gui.TextAlignment)).Cast <Terminal.Gui.TextAlignment> ().ToList();
            var label      = new Label($"Demonstrating single-line (should clip!):")
            {
                Y = 0
            };
            Win.Add(label);
            foreach (var alignment in alignments)
            {
                label = new Label($"{alignment}:")
                {
                    Y = Pos.Bottom(label)
                };
                Win.Add(label);
                label = new Label(txt)
                {
                    TextAlignment = alignment, Y = Pos.Bottom(label), Width = Dim.Fill(), Height = 1, ColorScheme = Colors.Dialog
                };
                Win.Add(label);
            }

            txt  += "\nSecond line\n\nFourth Line.";
            label = new Label($"Demonstrating multi-line and word wrap:")
            {
                Y = Pos.Bottom(label) + 1
            };
            Win.Add(label);
            foreach (var alignment in alignments)
            {
                label = new Label($"{alignment}:")
                {
                    Y = Pos.Bottom(label)
                };
                Win.Add(label);
                label = new Label(txt)
                {
                    TextAlignment = alignment, Width = Dim.Fill(), Height = 6, ColorScheme = Colors.Dialog, Y = Pos.Bottom(label)
                };
                Win.Add(label);
            }
        }
Exemple #16
0
        public void AddRune_On_Clip_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space()
        {
            var tv = new TextView()
            {
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
                Text   = @"これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。
これは広いルーンラインです。"
            };
            var win = new Window("ワイドルーン")
            {
                Width = Dim.Fill(), Height = Dim.Fill()
            };

            win.Add(tv);
            Application.Top.Add(win);
            var lbl = new Label("ワイドルーン。");
            var dg  = new Dialog("テスト", 14, 4, new Button("選ぶ"));

            dg.Add(lbl);
            Application.Begin(Application.Top);
            Application.Begin(dg);
            ((FakeDriver)Application.Driver).SetBufferSize(30, 10);

            var expected = @"
┌ ワイドルーン ──────────────┐
│これは広いルーンラインです。│
│これは広いルーンラインです。│
│これは ┌ テスト ────┐ です。│
│これは │ワイドルーン│ です。│
│これは │  [ 選ぶ ]  │ です。│
│これは └────────────┘ です。│
│これは広いルーンラインです。│
│これは広いルーンラインです。│
└────────────────────────────┘
";

            var pos = GraphViewTests.AssertDriverContentsWithFrameAre(expected, output);

            Assert.Equal(new Rect(0, 0, 30, 10), pos);
        }
        public void Init(string path)
        {
            var dbOnTheRocks     = new DataAssetsRocksDb(path, new DbConfig(), LimboLogs.Instance);
            var dataAssetsBytes  = dbOnTheRocks.GetAll();
            var dataAssetDecoder = new DataAssetDecoder();
            var dataAssets       = dataAssetsBytes
                                   .Select(b => dataAssetDecoder.Decode(b.Value.AsRlpStream()));

            var window = new Window("Data assets")
            {
                X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
            };

            if (!dataAssets.Any())
            {
                MessageBox.Query(40, 7, "Data assets", "No data." +
                                 $"{Environment.NewLine}(ESC to close)");
                window.FocusPrev();
                return;
            }

            var y = 1;

            foreach (var dataAsset in dataAssets)
            {
                var dataAssetsBtn = new Button(1, y++, $"Name: {dataAsset.Name}");

                dataAssetsBtn.Clicked = () =>
                {
                    var dataAssetDetailsWindow = new Window("Data asset details")
                    {
                        X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
                    };
                    Application.Top.Add(dataAssetDetailsWindow);

                    var serializer   = new EthereumJsonSerializer();
                    var dataAssetLbl = new Label(1, 1, serializer.Serialize(dataAsset, true));

                    dataAssetDetailsWindow.Add(dataAssetLbl);
                    Application.Run(dataAssetDetailsWindow);
                };
                window.Add(dataAssetsBtn);
            }

            Application.Top.Add(window);
            Application.Run(window);
        }
Exemple #18
0
        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);
        }
Exemple #19
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);
        }
Exemple #20
0
        public DescriptionWindow(WorkItem workItem) : base("[#" + workItem.Id + "] " + workItem.Title() + " - " + "Description")
        {
            X           = 0;
            Y           = 2; // Leave one row for the toplevel menu
            Width       = Dim.Fill();
            Height      = Dim.Fill();
            ColorScheme = Program.ColorScheme;

            Add(new TextView
            {
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = Program.ColorScheme,
                Text        = workItem.Description(),
                ReadOnly    = true
            });
        }
Exemple #21
0
        public Indicator(Color ForegroundOn, Color BackgroundOn, Color ForegroundOff, Color BackgroundOff)
        {
            DrawFrame(this.Bounds, 0, false);

            lbl = new Label("0")
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            colorAttributesOn  = Terminal.Gui.Attribute.Make(ForegroundOn, BackgroundOn);
            colorAttributesOff = Terminal.Gui.Attribute.Make(ForegroundOff, BackgroundOff);
            lbl.TextColor      = colorAttributesOn;
            Add(lbl);
        }
Exemple #22
0
        protected override void DrawWidget()
        {
            Title = settings.ProcessesListWidgetTitle;

            _dataSource             = new ProcessListDataSourceBuilder();
            _dataSource.HeaderStyle = Terminal.Gui.Attribute.Make(settings.ProcessesListWidgetHeaderTextColor, settings.ProcessesListWidgetHeaderBackgroundColor);
            _dataSource.FooterStyle = Terminal.Gui.Attribute.Make(settings.ProcessesListWidgetFooterTextColor, settings.ProcessesListWidgetFooterBackgroundColor);
            _grid = new Grid(_dataSource)
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            Add(_grid);
        }
        public void ConfigureJsonPane()
        {
            JsonView = new TextView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            JsonView.ReadOnly = true;

            // Set the colorscheme to make it stand out
            JsonView.ColorScheme = Colors.Dialog;

            HostPane.Add(JsonView);
        }
Exemple #24
0
        /// <summary>
        /// Initialize and run the UI main loop.
        /// </summary>
        public void RunUiLoop()
        {
            Application.Init();

            var contentWindow = new Window("Pull Requests To Review:")
            {
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = CustomColorSchemes.MutedEdges,
            };

            contentWindow.Add(new PullRequestView(FetchPrData()));

            Application.Top.Add(contentWindow);

            Application.Run();
        }
        public AcceptanceCriteriaWindow(WorkItem workItem) : base("[#" + workItem.Id + "] " + workItem.Title() + " - " + "Acceptance Criteria")
        {
            X           = 0;
            Y           = 2; // Leave one row for the toplevel menu
            Width       = Dim.Fill();
            Height      = Dim.Fill();
            ColorScheme = Program.ColorScheme;

            Add(new TextView
            {
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = Program.ColorScheme,
                Text        = workItem.AcceptanceCriteria(),//.WordWrap(Console.WindowWidth - 2),
                ReadOnly    = true
            });
        }
Exemple #26
0
        /// <summary>
        /// The Start method builds the user interface.
        /// </summary>
        public void Start()
        {
            // Creates a instance of MainLoop to process input events, handle timers and other sources of data.
            Application.Init();

            var top    = Application.Top;
            var tframe = top.Frame;

            // Create the top-level window.
            var win = new Window("MusicSharp")
            {
                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(),

                // Subtract one row for the statusbar
                Height = Dim.Fill() - 1,
            };

            // Create the menubar.
            var menu = new MenuBar(new MenuBarItem[]
            {
                new MenuBarItem("_File", new MenuItem[]
                {
                    new MenuItem("_Open", "Open a music file", () => this.player.PlayAudioFile()),

                    new MenuItem("_Load Stream", "Load a stream", () => OpenStream()),

                    new MenuItem("_Quit", "Exit MusicSharp", () => Application.RequestStop()),
                }),

                new MenuBarItem("_Help", new MenuItem[]
                {
                    new MenuItem("_About", string.Empty, () =>
                    {
                        MessageBox.Query("Music Sharp 0.3.1", "\nMusic Sharp is a lightweight CLI\n music player written in C#.\n\nDeveloped by Mark-James McDougall\nand licensed under the GPL v3.\n ", "Close");
                    }),
                }),
            });

            // Add the layout elements and run the app.
            top.Add(win, menu);
            Application.Run();
        }
Exemple #27
0
        public override void Setup()
        {
            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_Settings", new MenuItem [] {
                    null,
                    new MenuItem("_Quit", "", () => Quit()),
                }),
            });

            Top.Add(menu);

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

            Top.Add(statusBar);

            //Top.LayoutStyle = LayoutStyle.Computed;
            // Demonstrate using Dim to create a horizontal ruler that always measures the parent window's width
            // BUGBUG: Dim.Fill returns too big a value sometimes.
            const string rule            = "|123456789";
            var          horizontalRuler = new Label("")
            {
                X           = 0,
                Y           = 0,
                Width       = Dim.Fill(1),             // BUGBUG: I don't think this should be needed; DimFill() should respect container's frame. X does.
                ColorScheme = Colors.Error
            };

            Win.Add(horizontalRuler);

            // Demonstrate using Dim to create a vertical ruler that always measures the parent window's height
            // TODO: Either build a custom control for this or implement linewrap in Label #352
            const string vrule = "|\n1\n2\n3\n4\n5\n6\n7\n8\n9\n";

            var verticalRuler = new Label("")
            {
                X           = 0,
                Y           = 0,
                Width       = 1,
                Height      = Dim.Fill(),
                ColorScheme = Colors.Error
            };

            Win.LayoutComplete += (a) => {
                horizontalRuler.Text = rule.Repeat((int)Math.Ceiling((double)(horizontalRuler.Bounds.Width) / (double)rule.Length)) [0..(horizontalRuler.Bounds.Width)];
Exemple #28
0
        protected override void EndInit()
        {
            Height = Dim.Fill(5);

            AddButton("Commit To", OnNewBranchClicked);

            textView.X      = 1;
            textView.Y      = 1;
            textView.Width  = Dim.Fill(1);
            textView.Height = Dim.Height(this) - 7;
            textView.Text   = message ?? string.Empty;

            Add(textView);

            // Set IsInitialized and raise Initialized at the end.
            base.EndInit();
        }
Exemple #29
0
        public App() : base()
        {
            X      = 0;
            Y      = 0;
            Width  = Dim.Fill();
            Height = Dim.Fill() - 1;


            var ipRangeView = new IpRangeView();

            Add(ipRangeView);

            resultView.Y      = Pos.Bottom(ipRangeView);
            resultView.Width  = Dim.Fill();
            resultView.Height = Dim.Fill();
            Add(resultView);
        }
Exemple #30
0
        public void Init(string path)
        {
            var dbOnTheRocks            = new ConsumerSessionsRocksDb(path, new DbConfig(), LimboLogs.Instance);
            var consumerSessionsBytes   = dbOnTheRocks.GetAll();
            var consumerSessionsDecoder = new ConsumerSessionDecoder();
            var consumerSessions        = consumerSessionsBytes
                                          .Select(b => consumerSessionsDecoder.Decode(b.Value.AsRlpStream()));

            var window = new Window("Consumer sessions")
            {
                X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
            };

            if (!consumerSessions.Any())
            {
                MessageBox.Query(40, 7, "Consumer sessions", "No data." +
                                 $"{Environment.NewLine}(ESC to close)");
                window.FocusPrev();
                return;
            }

            var y = 1;

            foreach (var consumerSession in consumerSessions)
            {
                var consumerSessionBtn = new Button(1, y++, $"DepositId: {consumerSession.DepositId}," +
                                                    $"ConsumerAddress: {consumerSession.ConsumerAddress}");

                consumerSessionBtn.Clicked = () =>
                {
                    var consumerSessionDetailsWindow = new Window("Session details")
                    {
                        X = 0, Y = 10, Width = Dim.Fill(), Height = Dim.Fill()
                    };
                    Application.Top.Add(consumerSessionDetailsWindow);
                    var serializer         = new EthereumJsonSerializer();
                    var consumerSessionLbl = new Label(1, 1, serializer.Serialize(consumerSession, true));
                    consumerSessionDetailsWindow.Add(consumerSessionLbl);
                    Application.Run(consumerSessionDetailsWindow);
                };
                window.Add(consumerSessionBtn);
            }

            Application.Top.Add(window);
            Application.Run(window);
        }