1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

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

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

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

        特性

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

        瀏覽 25
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            中国一及黄片 | 日本大尺度激情做爰hd昼颜 | 我穿开裆裤的老公突然跟我打招呼 | 探花网址在线观看 | 国产网站在线 | 人妻大香蕉 | 国产精品久久久电影 | 国内夫妻做爱视频自拍 | 99久久精品免费看国产麻豆 | 伊人淫色 |