在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:migueldeicaza/gui.cs开源软件地址:https://github.com/migueldeicaza/gui.cs开源编程语言:C# 99.2%开源软件介绍:Terminal.Gui - Cross Platform Terminal GUI toolkit for .NETA toolkit for building console GUI apps for .NET, .NET Core, and Mono that works on Windows, the Mac, and Linux/Unix. Controls & FeaturesTerminal.Gui contains various controls for building text user interfaces:
In addition, a complete Xterm/Vt100 terminal emulator that you can embed is now part of XtermSharp - you just need to pull Features
Keyboard Input HandlingThe input handling of Terminal.Gui is similar in some ways to Emacs and the Midnight Commander, so you can expect some of the special key combinations to be active. The key To enter the key
Terminal.Gui respects common Mac and Windows keyboard idoms as well. For example, clipboard operations use the familiar
Terminal.Gui supports rebinding keys. For example the default key for activating a button is Enter. You can change this using the var btn = new Button ("Press Me");
btn.ClearKeybinding (Command.Accept);
btn.AddKeyBinding (Key.b, Command.Accept); The Not all controls have the same key bound for a given command, for example Keybindings only operate while a view has focus. To register global hotkeys you can override a view's Driver modelTerminal.Gui has support for ncurses,
You can force the use of Showcase & Examples
DocumentationSee the Sample UsageThe code below is done with the new Top-level statements in C# 9.0. using Terminal.Gui;
using NStack;
Application.Init();
var top = Application.Top;
// Creates the top-level window to show
var win = new Window("MyApp")
{
X = 0,
Y = 1, // Leave one row for the toplevel menu
// By using Dim.Fill(), it will automatically resize without manual intervention
Width = Dim.Fill(),
Height = Dim.Fill()
};
top.Add(win);
// Creates a menubar, the item "New" has a help menu.
var menu = new MenuBar(new MenuBarItem[] {
new MenuBarItem ("_File", new MenuItem [] {
new MenuItem ("_New", "Creates new file", null),
new MenuItem ("_Close", "",null),
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);
static bool Quit()
{
var n = MessageBox.Query(50, 7, "Quit Demo", "Are you sure you want to quit this demo?", "Yes", "No");
return n == 0;
}
var login = new Label("Login: ") { X = 3, Y = 2 };
var password = new Label("Password: ")
{
X = Pos.Left(login),
Y = Pos.Top(login) + 1
};
var loginText = new TextField("")
{
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, Computed
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 ustring[] { "_Personal", "_Company" }, 0),
new Button(3, 14, "Ok"),
new Button(10, 14, "Cancel"),
new Label(3, 18, "Press F9 or ESC plus 9 to activate the menubar")
);
Application.Run();
Application.Shutdown(); Alternatively, you can encapsulate the app behavior in a new using Terminal.Gui;
class Demo {
static void Main ()
{
Application.Run<App> ();
Application.Shutdown ();
}
} The example above shows how to add views using both styles of layout supported by Terminal.Gui: Absolute layout and Computed layout. InstallingUse NuGet to install the Installation in .NET Core ProjectsTo install Terminal.Gui into a .NET Core project, use the
Running and Building
Building in Release requires the git command line tool (a dependency of the MinVer build tool) ContributingSee CONTRIBUTING.md. Debates on architecture and design can be found in Issues tagged with design. HistoryThis is an updated version of gui.cs that Miguel wrote for mono-curses in 2007. The original gui.cs was a UI toolkit in a single file and tied to curses. This version tries to be console-agnostic and instead of having a container/widget model, only uses Views (which can contain subviews) and changes the rendering model to rely on damage regions instead of burdening each view with the details. A presentation of this was part of the Retro.NET talk at .NET Conf 2018 Slides Release history can be found in the Terminal.Gui.csproj file. In 2019, 2020, and 2021, Charlie Kindel (https://github.com/tig), @BDisp (https://github.com/BDisp), and Thomas Nind (https://github.com/tznind) vastly extended, improved, polished and fixed gui.cs to what it is today. |
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论