<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Terminal.Gui.NET 跨平臺終端 UI 工具包

          聯(lián)合創(chuàng)作 · 2023-09-28 06:06

          Terminal.Gui 是適用于 .NET 的跨平臺終端 UI 工具包。

          特性

          • 跨平臺:支持 Windows、Mac 和 Linux。Curses、Windows 控制臺和 .NET 控制臺的終端驅(qū)動(dòng)程序意味著應(yīng)用程序在彩色和單色終端上都能正常運(yùn)行。
          • 鍵盤和鼠標(biāo)輸入:支持鍵盤和鼠標(biāo)輸入,包括拖放支持。
          • 靈活布局:支持絕對布局和創(chuàng)新的計(jì)算布局系統(tǒng) (Computed Layout)。Computed Layout 使控件之間的相對布局變得容易,并支持動(dòng)態(tài)終端 UI。
          • 支持剪貼板:剪切、復(fù)制和粘貼通過Clipboard類提供的文本。
          • 任意視圖:所有可見的 UI 元素都是View類的子類,而這些子類又可以包含任意數(shù)量的 sub-views。
          • 高級應(yīng)用程序功能:主循環(huán)支持處理事件、空閑處理程序、計(jì)時(shí)器和監(jiān)控文件描述符。大多數(shù)類對于 threading 是安全的。
          • 響應(yīng)式擴(kuò)展 (Reactive Extensions):使用響應(yīng)式擴(kuò)展并受益于提高的代碼可讀性,以及應(yīng)用 MVVM 模式和 ReactiveUI 數(shù)據(jù)綁定的能力。

          示例代碼

          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();

          上面的示例顯示了使用 Terminal.Gui 支持的兩種布局樣式添加視圖:絕對布局和計(jì)算布局。

          瀏覽 25
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  天天撸免费视频播放 | 黄片操B 黄片高清 | 国产网站在线 | 欧美精品狂野欧美成人 | 操逼大鸡吧 |