Example #1
0
        public static void Main(string [] args)
        {
            Application.Init();

            var menu = new MenuBar(new MenuBarItem [] {
                new MenuBarItem("_File", new MenuItem [] {
                    new MenuItem("_Close", "", () => Close()),
                    new MenuItem("_Quit", "", () => { Application.RequestStop(); })
                }),
                new MenuBarItem("_Edit", new MenuItem [] {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                }),
            });

            var login = new Label("Login: "******"Password: "******"")
            {
                X           = Pos.Right(password),
                Y           = Pos.Top(login),
                Width       = 40,
                ColorScheme = new ColorScheme()
                {
                    Focus     = Attribute.Make(Color.BrightYellow, Color.DarkGray),
                    Normal    = Attribute.Make(Color.Green, Color.BrightYellow),
                    HotFocus  = Attribute.Make(Color.BrightBlue, Color.Brown),
                    HotNormal = Attribute.Make(Color.Red, Color.BrightRed),
                },
            };

            var passText = new TextField("")
            {
                Secret = true,
                X      = Pos.Left(loginText),
                Y      = Pos.Top(password),
                Width  = Dim.Width(loginText)
            };

            surface.Add(login, password, loginText, passText);
            Application.Top.Add(menu, surface);
            Application.Run();
        }
Example #2
0
        public MapView()
        {
            _attBlack = Attribute.Make((Color)ConsoleColor.Black, (Color)ConsoleColor.Black);

            foreach (Color c in Enum.GetValues(typeof(Color)))
            {
                _regularColors.Add(c, Attribute.Make(c, Color.Black));
                _invertedColors.Add(c, Attribute.Make(Color.Black, c));
            }
        }
Example #3
0
            public static void Init()
            {
                #region operation complete
                Complete.ColorScheme = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.Black, Color.BrightGreen),
                    Focus     = TGAttribute.Make(Color.Black, Color.BrightGreen),
                    HotNormal = TGAttribute.Make(Color.Black, Color.BrightGreen),
                    HotFocus  = TGAttribute.Make(Color.Black, Color.BrightGreen)
                };

                Complete.Width  = 25;
                Complete.Height = 3;

                Complete.X = Pos.Center();
                Complete.Y = Pos.Center();

                Complete.Add(quitComplete);
                #endregion

                #region file info
                Extract.AllFiles.ColorScheme = Program.ArchivedList;

                Extract.AllFiles.Width  = Dim.Percent(80);
                Extract.AllFiles.Height = Dim.Percent(80);

                Extract.AllFiles.X = Pos.Center();
                Extract.AllFiles.Y = Pos.Center();

                Extract.AllFiles.Add(Extract.infoLabel);
                Extract.AllFiles.Add(Extract.allFilesNext);
                Extract.AllFiles.Add(Extract.allFilesLast);
                Extract.AllFiles.Add(Extract.quitAllFiles);
                #endregion

                #region error
                Error.ColorScheme = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.White, Color.BrightRed),
                    Focus     = TGAttribute.Make(Color.White, Color.BrightRed),
                    HotNormal = TGAttribute.Make(Color.White, Color.BrightRed),
                    HotFocus  = TGAttribute.Make(Color.White, Color.BrightRed)
                };

                Error.Width  = 50;
                Error.Height = Dim.Percent(50);

                Error.X = Pos.Center();
                Error.Y = Pos.Center();
                #endregion
            }
Example #4
0
        public static async Task Main(string[] args)
        {
            Application.Init();
            Application.Top.WantMousePositionReports = false;

            ColorScheme = new ColorScheme
            {
                Normal    = Attribute.Make(Color.White, Color.Black),
                HotNormal = Attribute.Make(Color.Red, Color.Black),
                Focus     = Attribute.Make(Color.Black, Color.BrightRed),
                HotFocus  = Attribute.Make(Color.Red, Color.White)
            };

            Application.Top.ColorScheme = ColorScheme;

            var command = Command.Load(args);

            if (command is SettingsCommand)
            { // Special case for AuthCommand, since it doesn't rely on a valid settings file to work.
                await command.Execute();

                return;
            }

            var settings = Settings.Load();

            Settings = settings;

            Api = new VssConnection(settings.Url, new VssBasicCredential(string.Empty, settings.Token));
            await command.Execute();

            Application.Run();

            // Creates a menubar, the item "New" has a help menu.
            // var menu = new MenuBar(new  []
            // {
            //     new MenuBarItem("_File", new  []
            //     {
            //         new MenuItem("_New", "Creates new file", () => { }),
            //         new MenuItem("_Close", "", () =>  { }),
            //         new MenuItem("_Quit", "", () => {  })
            //     }),
            //     new MenuBarItem("_Edit", new  []
            //     {
            //         new MenuItem("_Copy", "", null),
            //         new MenuItem("_Cut", "", null),
            //         new MenuItem("_Paste", "", null)
            //     })
            // });
            // top.Add(menu);
            //
            // var login = new Label("Login: "******"Password: "******"")
            // {
            //     X = Pos.Right(password),
            //     Y = Pos.Top(login),
            //     Width = 40
            // };
            // var passText = new TextField("")
            // {
            //     Secret = true,
            //     X = Pos.Left(loginText),
            //     Y = Pos.Top(password),
            //     Width = Dim.Width(loginText)
            // };
            //
            // // Add some controls,
            // win.Add(
            //     // The ones with my favorite layout system
            //     login, password, loginText, passText,
            //
            //     // The ones laid out like an australopithecus, with absolute positions:
            //     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 F9 or ESC plus 9 to activate the menubar"));
        }
Example #5
0
        public static void Theme(int mode)
        {
            switch (mode)
            {
            case 0:
            {
                Colors.Base = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.White, Color.Black),
                    HotNormal = TGAttribute.Make(Color.White, Color.DarkGray),
                    Focus     = TGAttribute.Make(Color.White, Color.Blue),
                    HotFocus  = TGAttribute.Make(Color.BrighCyan, Color.Blue)
                };

                Colors.Menu = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.Black, Color.Gray),
                    Focus     = TGAttribute.Make(Color.White, Color.Blue),
                    HotNormal = TGAttribute.Make(Color.DarkGray, Color.Gray),
                    HotFocus  = TGAttribute.Make(Color.BrighCyan, Color.Blue)
                };

                Colors.Dialog = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.White, Color.DarkGray),
                    Focus     = TGAttribute.Make(Color.White, Color.Blue),
                    HotNormal = TGAttribute.Make(Color.Blue, Color.White),
                    HotFocus  = TGAttribute.Make(Color.BrighCyan, Color.Blue)
                };

                ArchivedList = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.White, Color.Blue),
                    Focus     = TGAttribute.Make(Color.White, Color.BrightBlue),
                    HotNormal = TGAttribute.Make(Color.White, Color.Blue),
                    HotFocus  = TGAttribute.Make(Color.White, Color.BrightBlue)
                };

                HighlighedLabel = new ColorScheme()
                {
                    Normal = TGAttribute.Make(Color.BrightYellow, Color.Black)
                };
                break;
            }

            case 1:
            {
                Colors.Base = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.Black, Color.Gray),
                    HotNormal = TGAttribute.Make(Color.White, Color.DarkGray),

                    Focus    = TGAttribute.Make(Color.White, Color.Brown),
                    HotFocus = TGAttribute.Make(Color.BrightYellow, Color.Brown)
                };

                Colors.Menu = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.Black, Color.Gray),
                    Focus     = TGAttribute.Make(Color.White, Color.Blue),
                    HotNormal = TGAttribute.Make(Color.DarkGray, Color.Gray),
                    HotFocus  = TGAttribute.Make(Color.BrighCyan, Color.Blue)
                };

                Colors.Dialog = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.Black, Color.White),
                    Focus     = TGAttribute.Make(Color.White, Color.Brown),
                    HotNormal = TGAttribute.Make(Color.Brown, Color.White),
                    HotFocus  = TGAttribute.Make(Color.BrightYellow, Color.Brown)
                };

                ArchivedList = new ColorScheme()
                {
                    Normal    = TGAttribute.Make(Color.White, Color.Brown),
                    Focus     = TGAttribute.Make(Color.Black, Color.BrightYellow),
                    HotNormal = TGAttribute.Make(Color.White, Color.Brown),
                    HotFocus  = TGAttribute.Make(Color.Black, Color.BrightYellow)
                };

                HighlighedLabel = new ColorScheme()
                {
                    Normal = TGAttribute.Make(Color.BrightBlue, Color.Gray)
                };
                break;
            }

            default: { break; }
            }

            StaticWindows.RefreshColors();
            Application.Refresh();
        }
Example #6
0
        public int OnExecute()
        {
            Application.Init();

            var top = new CustomWindow
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            top.ColorScheme = new ColorScheme
            {
                Focus     = TerminalAttribute.Make(Color.Brown, Color.Black),
                HotFocus  = TerminalAttribute.Make(Color.BrightYellow, Color.Black),
                HotNormal = TerminalAttribute.Make(Color.Gray, Color.Black),
                Normal    = TerminalAttribute.Make(Color.White, Color.Black)
            };

            var discovery = CreateDiscoveryWindow();

            discovery.ColorScheme = top.ColorScheme;

            var locate = CreateLocateWindow();

            locate.ColorScheme = top.ColorScheme;

            var menu = new MenuBar(
                new[]
            {
                new MenuBarItem(
                    "_File",
                    new[]
                {
                    new MenuItem(
                        "_Discovery",
                        "Discover registered conventions and their orders",
                        openDiscovery
                        ),
                    new MenuItem(
                        "_Locate",
                        "Locate all available conventions from different assemblies",
                        openLocate
                        )
                }
                    )
            }
                );

            top.Add(menu);

            void openDiscovery()
            {
                top.Remove(locate);
                top.Add(discovery);
                Application.RequestStop();
                Application.Run(top);
            }

            void openLocate()
            {
                top.Remove(discovery);
                top.Add(locate);
                Application.RequestStop();
                Application.Run(top);
            }

            openDiscovery();

            return(0);
        }
Example #7
0
        private static void Main(string[] args)
        {
            Application.Init();
            var top = Application.Top;

            top.ColorScheme.Normal = Attribute.Make(Color.White, Color.Black);
            // Creates the top-level window to show
            var win = new Window("Tic-Tac-Toe")
            {
                X = 0,
                Y = 1,

                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            top.Add(win);

            var menu = new MenuBar(new[]
            {
                new MenuBarItem("_Game", new[]
                {
                    new MenuItem("_New", "Creates new game", NewGame),
                    new MenuItem("_Close", "", Close),
                    new MenuItem("_Quit", "", () =>
                    {
                        if (Quit())
                        {
                            top.Running = false;
                        }
                    })
                }),
                new MenuBarItem("_Edit", new[]
                {
                    new MenuItem("_Copy", "", null),
                    new MenuItem("C_ut", "", null),
                    new MenuItem("_Paste", "", null)
                })
            });

            top.Add(menu);

            var field = new Window("Field")
            {
                X      = 3,
                Y      = 2,
                Width  = 17,
                Height = 7
            };

            field.ColorScheme.Focus = Attribute.Make(Color.Magenta, Color.Black);
            var figure = new RadioGroup(3, 0, new ustring[] { "X", "O" })
            {
                DisplayMode = DisplayModeLayout.Horizontal,
            };

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    var button = new Button(j * 5, i * 2, ".")
                    {
                        Id = $"{i},{j}"
                    };
                    button.Clicked += delegate()
                    {
                        button.Text = figure.RadioLabels[figure.SelectedItem];
                    };
                    field.Add(button);
                }
            }

            field.Add(new Label(0, 1, "---------------"));
            field.Add(new Label(0, 3, "---------------"));

            win.Add(
                field,
                figure
                );

            Application.Run();
        }