Terminal.Gui.Application.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <!DOCTYPE html>
  2. <!--[if IE]><![endif]-->
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <title>Class Application
  8. </title>
  9. <meta name="viewport" content="width=device-width">
  10. <meta name="title" content="Class Application
  11. ">
  12. <meta name="generator" content="docfx 2.56.7.0">
  13. <link rel="shortcut icon" href="../../favicon.ico">
  14. <link rel="stylesheet" href="../../styles/docfx.vendor.css">
  15. <link rel="stylesheet" href="../../styles/docfx.css">
  16. <link rel="stylesheet" href="../../styles/main.css">
  17. <meta property="docfx:navrel" content="../../toc.html">
  18. <meta property="docfx:tocrel" content="toc.html">
  19. <meta property="docfx:rel" content="../../">
  20. </head>
  21. <body data-spy="scroll" data-target="#affix" data-offset="120">
  22. <div id="wrapper">
  23. <header>
  24. <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
  25. <div class="container">
  26. <div class="navbar-header">
  27. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
  28. <span class="sr-only">Toggle navigation</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="../../index.html">
  34. <img id="logo" class="svg" src="../../images/logo48.png" alt="">
  35. </a>
  36. </div>
  37. <div class="collapse navbar-collapse" id="navbar">
  38. <form class="navbar-form navbar-right" role="search" id="search">
  39. <div class="form-group">
  40. <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
  41. </div>
  42. </form>
  43. </div>
  44. </div>
  45. </nav>
  46. <div class="subnav navbar navbar-default">
  47. <div class="container hide-when-search" id="breadcrumb">
  48. <ul class="breadcrumb">
  49. <li></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </header>
  54. <div class="container body-content">
  55. <div id="search-results">
  56. <div class="search-list">Search Results for <span></span></div>
  57. <div class="sr-items">
  58. <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
  59. </div>
  60. <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
  61. </div>
  62. </div>
  63. <div role="main" class="container body-content hide-when-search">
  64. <div class="sidenav hide-when-search">
  65. <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
  66. <div class="sidetoggle collapse" id="sidetoggle">
  67. <div id="sidetoc"></div>
  68. </div>
  69. </div>
  70. <div class="article row grid-right">
  71. <div class="col-md-10">
  72. <article class="content wrap" id="_content" data-uid="Terminal.Gui.Application">
  73. <h1 id="Terminal_Gui_Application" data-uid="Terminal.Gui.Application" class="text-break">Class Application
  74. </h1>
  75. <div class="markdown level0 summary">
  76. A static, singelton class provding the main application driver for Terminal.Gui apps.
  77. </div>
  78. <div class="markdown level0 conceptual"></div>
  79. <div class="inheritance">
  80. <h5>Inheritance</h5>
  81. <div class="level0"><span class="xref">System.Object</span></div>
  82. <div class="level1"><span class="xref">Application</span></div>
  83. </div>
  84. <div class="inheritedMembers">
  85. <h5>Inherited Members</h5>
  86. <div>
  87. <span class="xref">System.Object.Equals(System.Object)</span>
  88. </div>
  89. <div>
  90. <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
  91. </div>
  92. <div>
  93. <span class="xref">System.Object.GetHashCode()</span>
  94. </div>
  95. <div>
  96. <span class="xref">System.Object.GetType()</span>
  97. </div>
  98. <div>
  99. <span class="xref">System.Object.MemberwiseClone()</span>
  100. </div>
  101. <div>
  102. <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
  103. </div>
  104. <div>
  105. <span class="xref">System.Object.ToString()</span>
  106. </div>
  107. </div>
  108. <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
  109. <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
  110. <h5 id="Terminal_Gui_Application_syntax">Syntax</h5>
  111. <div class="codewrapper">
  112. <pre><code class="lang-csharp hljs">public static class Application</code></pre>
  113. </div>
  114. <h5 id="Terminal_Gui_Application_remarks"><strong>Remarks</strong></h5>
  115. <div class="markdown level0 remarks">
  116. <p>
  117. Creates a instance of <a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a> to process input events, handle timers and
  118. other sources of data. It is accessible via the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a> property.
  119. </p>
  120. <p>
  121. You can hook up to the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Iteration">Iteration</a> event to have your method
  122. invoked on each iteration of the <a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a>.
  123. </p>
  124. <p>
  125. When invoked sets the SynchronizationContext to one that is tied
  126. to the mainloop, allowing user code to use async/await.
  127. </p>
  128. </div>
  129. <h5 id="Terminal_Gui_Application_examples"><strong>Examples</strong></h5>
  130. <pre><code>// A simple Terminal.Gui app that creates a window with a frame and title with
  131. // 5 rows/columns of padding.
  132. Application.Init();
  133. var win = new Window (&quot;Hello World - CTRL-Q to quit&quot;) {
  134. X = 5,
  135. Y = 5,
  136. Width = Dim.Fill (5),
  137. Height = Dim.Fill (5)
  138. };
  139. Application.Top.Add(win);
  140. Application.Run();</code></pre>
  141. <h3 id="fields">Fields
  142. </h3>
  143. <h4 id="Terminal_Gui_Application_Driver" data-uid="Terminal.Gui.Application.Driver">Driver</h4>
  144. <div class="markdown level1 summary">
  145. The current <a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a> in use.
  146. </div>
  147. <div class="markdown level1 conceptual"></div>
  148. <h5 class="decalaration">Declaration</h5>
  149. <div class="codewrapper">
  150. <pre><code class="lang-csharp hljs">public static ConsoleDriver Driver</code></pre>
  151. </div>
  152. <h5 class="fieldValue">Field Value</h5>
  153. <table class="table table-bordered table-striped table-condensed">
  154. <thead>
  155. <tr>
  156. <th>Type</th>
  157. <th>Description</th>
  158. </tr>
  159. </thead>
  160. <tbody>
  161. <tr>
  162. <td><a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a></td>
  163. <td></td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <h4 id="Terminal_Gui_Application_Iteration" data-uid="Terminal.Gui.Application.Iteration">Iteration</h4>
  168. <div class="markdown level1 summary">
  169. This event is raised on each iteration of the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a>
  170. </div>
  171. <div class="markdown level1 conceptual"></div>
  172. <h5 class="decalaration">Declaration</h5>
  173. <div class="codewrapper">
  174. <pre><code class="lang-csharp hljs">public static Action Iteration</code></pre>
  175. </div>
  176. <h5 class="fieldValue">Field Value</h5>
  177. <table class="table table-bordered table-striped table-condensed">
  178. <thead>
  179. <tr>
  180. <th>Type</th>
  181. <th>Description</th>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. <tr>
  186. <td><span class="xref">System.Action</span></td>
  187. <td></td>
  188. </tr>
  189. </tbody>
  190. </table>
  191. <h5 id="Terminal_Gui_Application_Iteration_remarks">Remarks</h5>
  192. <div class="markdown level1 remarks">
  193. See also <span class="xref">System.Threading.Timeout</span>
  194. </div>
  195. <h4 id="Terminal_Gui_Application_Resized" data-uid="Terminal.Gui.Application.Resized">Resized</h4>
  196. <div class="markdown level1 summary">
  197. Invoked when the terminal was resized. The new size of the terminal is provided.
  198. </div>
  199. <div class="markdown level1 conceptual"></div>
  200. <h5 class="decalaration">Declaration</h5>
  201. <div class="codewrapper">
  202. <pre><code class="lang-csharp hljs">public static Action&lt;Application.ResizedEventArgs&gt; Resized</code></pre>
  203. </div>
  204. <h5 class="fieldValue">Field Value</h5>
  205. <table class="table table-bordered table-striped table-condensed">
  206. <thead>
  207. <tr>
  208. <th>Type</th>
  209. <th>Description</th>
  210. </tr>
  211. </thead>
  212. <tbody>
  213. <tr>
  214. <td><span class="xref">System.Action</span>&lt;<a class="xref" href="Terminal.Gui.Application.ResizedEventArgs.html">Application.ResizedEventArgs</a>&gt;</td>
  215. <td></td>
  216. </tr>
  217. </tbody>
  218. </table>
  219. <h4 id="Terminal_Gui_Application_RootMouseEvent" data-uid="Terminal.Gui.Application.RootMouseEvent">RootMouseEvent</h4>
  220. <div class="markdown level1 summary">
  221. Merely a debugging aid to see the raw mouse events
  222. </div>
  223. <div class="markdown level1 conceptual"></div>
  224. <h5 class="decalaration">Declaration</h5>
  225. <div class="codewrapper">
  226. <pre><code class="lang-csharp hljs">public static Action&lt;MouseEvent&gt; RootMouseEvent</code></pre>
  227. </div>
  228. <h5 class="fieldValue">Field Value</h5>
  229. <table class="table table-bordered table-striped table-condensed">
  230. <thead>
  231. <tr>
  232. <th>Type</th>
  233. <th>Description</th>
  234. </tr>
  235. </thead>
  236. <tbody>
  237. <tr>
  238. <td><span class="xref">System.Action</span>&lt;<a class="xref" href="Terminal.Gui.MouseEvent.html">MouseEvent</a>&gt;</td>
  239. <td></td>
  240. </tr>
  241. </tbody>
  242. </table>
  243. <h4 id="Terminal_Gui_Application_UseSystemConsole" data-uid="Terminal.Gui.Application.UseSystemConsole">UseSystemConsole</h4>
  244. <div class="markdown level1 summary">
  245. If set, it forces the use of the System.Console-based driver.
  246. </div>
  247. <div class="markdown level1 conceptual"></div>
  248. <h5 class="decalaration">Declaration</h5>
  249. <div class="codewrapper">
  250. <pre><code class="lang-csharp hljs">public static bool UseSystemConsole</code></pre>
  251. </div>
  252. <h5 class="fieldValue">Field Value</h5>
  253. <table class="table table-bordered table-striped table-condensed">
  254. <thead>
  255. <tr>
  256. <th>Type</th>
  257. <th>Description</th>
  258. </tr>
  259. </thead>
  260. <tbody>
  261. <tr>
  262. <td><span class="xref">System.Boolean</span></td>
  263. <td></td>
  264. </tr>
  265. </tbody>
  266. </table>
  267. <h3 id="properties">Properties
  268. </h3>
  269. <a id="Terminal_Gui_Application_AlwaysSetPosition_" data-uid="Terminal.Gui.Application.AlwaysSetPosition*"></a>
  270. <h4 id="Terminal_Gui_Application_AlwaysSetPosition" data-uid="Terminal.Gui.Application.AlwaysSetPosition">AlwaysSetPosition</h4>
  271. <div class="markdown level1 summary">
  272. Used only by <span class="xref">Terminal.Gui.NetDriver</span> to forcing always moving the cursor position when writing to the screen.
  273. </div>
  274. <div class="markdown level1 conceptual"></div>
  275. <h5 class="decalaration">Declaration</h5>
  276. <div class="codewrapper">
  277. <pre><code class="lang-csharp hljs">public static bool AlwaysSetPosition { get; set; }</code></pre>
  278. </div>
  279. <h5 class="propertyValue">Property Value</h5>
  280. <table class="table table-bordered table-striped table-condensed">
  281. <thead>
  282. <tr>
  283. <th>Type</th>
  284. <th>Description</th>
  285. </tr>
  286. </thead>
  287. <tbody>
  288. <tr>
  289. <td><span class="xref">System.Boolean</span></td>
  290. <td></td>
  291. </tr>
  292. </tbody>
  293. </table>
  294. <a id="Terminal_Gui_Application_Current_" data-uid="Terminal.Gui.Application.Current*"></a>
  295. <h4 id="Terminal_Gui_Application_Current" data-uid="Terminal.Gui.Application.Current">Current</h4>
  296. <div class="markdown level1 summary">
  297. The current <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> object. This is updated when <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_System_Func_System_Exception_System_Boolean__">Run(Func&lt;Exception, Boolean&gt;)</a> enters and leaves to point to the current <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> .
  298. </div>
  299. <div class="markdown level1 conceptual"></div>
  300. <h5 class="decalaration">Declaration</h5>
  301. <div class="codewrapper">
  302. <pre><code class="lang-csharp hljs">public static Toplevel Current { get; }</code></pre>
  303. </div>
  304. <h5 class="propertyValue">Property Value</h5>
  305. <table class="table table-bordered table-striped table-condensed">
  306. <thead>
  307. <tr>
  308. <th>Type</th>
  309. <th>Description</th>
  310. </tr>
  311. </thead>
  312. <tbody>
  313. <tr>
  314. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  315. <td>The current.</td>
  316. </tr>
  317. </tbody>
  318. </table>
  319. <a id="Terminal_Gui_Application_HeightAsBuffer_" data-uid="Terminal.Gui.Application.HeightAsBuffer*"></a>
  320. <h4 id="Terminal_Gui_Application_HeightAsBuffer" data-uid="Terminal.Gui.Application.HeightAsBuffer">HeightAsBuffer</h4>
  321. <div class="markdown level1 summary">
  322. The current <a class="xref" href="Terminal.Gui.ConsoleDriver.html#Terminal_Gui_ConsoleDriver_HeightAsBuffer">HeightAsBuffer</a> used in the terminal.
  323. </div>
  324. <div class="markdown level1 conceptual"></div>
  325. <h5 class="decalaration">Declaration</h5>
  326. <div class="codewrapper">
  327. <pre><code class="lang-csharp hljs">public static bool HeightAsBuffer { get; set; }</code></pre>
  328. </div>
  329. <h5 class="propertyValue">Property Value</h5>
  330. <table class="table table-bordered table-striped table-condensed">
  331. <thead>
  332. <tr>
  333. <th>Type</th>
  334. <th>Description</th>
  335. </tr>
  336. </thead>
  337. <tbody>
  338. <tr>
  339. <td><span class="xref">System.Boolean</span></td>
  340. <td></td>
  341. </tr>
  342. </tbody>
  343. </table>
  344. <a id="Terminal_Gui_Application_MainLoop_" data-uid="Terminal.Gui.Application.MainLoop*"></a>
  345. <h4 id="Terminal_Gui_Application_MainLoop" data-uid="Terminal.Gui.Application.MainLoop">MainLoop</h4>
  346. <div class="markdown level1 summary">
  347. The <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_MainLoop">MainLoop</a> driver for the application
  348. </div>
  349. <div class="markdown level1 conceptual"></div>
  350. <h5 class="decalaration">Declaration</h5>
  351. <div class="codewrapper">
  352. <pre><code class="lang-csharp hljs">public static MainLoop MainLoop { get; }</code></pre>
  353. </div>
  354. <h5 class="propertyValue">Property Value</h5>
  355. <table class="table table-bordered table-striped table-condensed">
  356. <thead>
  357. <tr>
  358. <th>Type</th>
  359. <th>Description</th>
  360. </tr>
  361. </thead>
  362. <tbody>
  363. <tr>
  364. <td><a class="xref" href="Terminal.Gui.MainLoop.html">MainLoop</a></td>
  365. <td>The main loop.</td>
  366. </tr>
  367. </tbody>
  368. </table>
  369. <a id="Terminal_Gui_Application_Top_" data-uid="Terminal.Gui.Application.Top*"></a>
  370. <h4 id="Terminal_Gui_Application_Top" data-uid="Terminal.Gui.Application.Top">Top</h4>
  371. <div class="markdown level1 summary">
  372. The <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> object used for the application on startup (<a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a>)
  373. </div>
  374. <div class="markdown level1 conceptual"></div>
  375. <h5 class="decalaration">Declaration</h5>
  376. <div class="codewrapper">
  377. <pre><code class="lang-csharp hljs">public static Toplevel Top { get; }</code></pre>
  378. </div>
  379. <h5 class="propertyValue">Property Value</h5>
  380. <table class="table table-bordered table-striped table-condensed">
  381. <thead>
  382. <tr>
  383. <th>Type</th>
  384. <th>Description</th>
  385. </tr>
  386. </thead>
  387. <tbody>
  388. <tr>
  389. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  390. <td>The top.</td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. <h3 id="methods">Methods
  395. </h3>
  396. <a id="Terminal_Gui_Application_Begin_" data-uid="Terminal.Gui.Application.Begin*"></a>
  397. <h4 id="Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_" data-uid="Terminal.Gui.Application.Begin(Terminal.Gui.Toplevel)">Begin(Toplevel)</h4>
  398. <div class="markdown level1 summary">
  399. Building block API: Prepares the provided <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> for execution.
  400. </div>
  401. <div class="markdown level1 conceptual"></div>
  402. <h5 class="decalaration">Declaration</h5>
  403. <div class="codewrapper">
  404. <pre><code class="lang-csharp hljs">public static Application.RunState Begin(Toplevel toplevel)</code></pre>
  405. </div>
  406. <h5 class="parameters">Parameters</h5>
  407. <table class="table table-bordered table-striped table-condensed">
  408. <thead>
  409. <tr>
  410. <th>Type</th>
  411. <th>Name</th>
  412. <th>Description</th>
  413. </tr>
  414. </thead>
  415. <tbody>
  416. <tr>
  417. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  418. <td><span class="parametername">toplevel</span></td>
  419. <td>Toplevel to prepare execution for.</td>
  420. </tr>
  421. </tbody>
  422. </table>
  423. <h5 class="returns">Returns</h5>
  424. <table class="table table-bordered table-striped table-condensed">
  425. <thead>
  426. <tr>
  427. <th>Type</th>
  428. <th>Description</th>
  429. </tr>
  430. </thead>
  431. <tbody>
  432. <tr>
  433. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  434. <td>The runstate handle that needs to be passed to the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_">End(Application.RunState)</a> method upon completion.</td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. <h5 id="Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel__remarks">Remarks</h5>
  439. <div class="markdown level1 remarks">
  440. This method prepares the provided toplevel for running with the focus,
  441. it adds this to the list of toplevels, sets up the mainloop to process the
  442. event, lays out the subviews, focuses the first element, and draws the
  443. toplevel in the screen. This is usually followed by executing
  444. the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> method, and then the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_">End(Application.RunState)</a> method upon termination which will
  445. undo these changes.
  446. </div>
  447. <a id="Terminal_Gui_Application_End_" data-uid="Terminal.Gui.Application.End*"></a>
  448. <h4 id="Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_" data-uid="Terminal.Gui.Application.End(Terminal.Gui.Application.RunState)">End(Application.RunState)</h4>
  449. <div class="markdown level1 summary">
  450. Building block API: completes the execution of a <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> that was started with <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> .
  451. </div>
  452. <div class="markdown level1 conceptual"></div>
  453. <h5 class="decalaration">Declaration</h5>
  454. <div class="codewrapper">
  455. <pre><code class="lang-csharp hljs">public static void End(Application.RunState runState)</code></pre>
  456. </div>
  457. <h5 class="parameters">Parameters</h5>
  458. <table class="table table-bordered table-striped table-condensed">
  459. <thead>
  460. <tr>
  461. <th>Type</th>
  462. <th>Name</th>
  463. <th>Description</th>
  464. </tr>
  465. </thead>
  466. <tbody>
  467. <tr>
  468. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  469. <td><span class="parametername">runState</span></td>
  470. <td>The runstate returned by the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> method.</td>
  471. </tr>
  472. </tbody>
  473. </table>
  474. <a id="Terminal_Gui_Application_GrabMouse_" data-uid="Terminal.Gui.Application.GrabMouse*"></a>
  475. <h4 id="Terminal_Gui_Application_GrabMouse_Terminal_Gui_View_" data-uid="Terminal.Gui.Application.GrabMouse(Terminal.Gui.View)">GrabMouse(View)</h4>
  476. <div class="markdown level1 summary">
  477. Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse is called.
  478. </div>
  479. <div class="markdown level1 conceptual"></div>
  480. <h5 class="decalaration">Declaration</h5>
  481. <div class="codewrapper">
  482. <pre><code class="lang-csharp hljs">public static void GrabMouse(View view)</code></pre>
  483. </div>
  484. <h5 class="parameters">Parameters</h5>
  485. <table class="table table-bordered table-striped table-condensed">
  486. <thead>
  487. <tr>
  488. <th>Type</th>
  489. <th>Name</th>
  490. <th>Description</th>
  491. </tr>
  492. </thead>
  493. <tbody>
  494. <tr>
  495. <td><a class="xref" href="Terminal.Gui.View.html">View</a></td>
  496. <td><span class="parametername">view</span></td>
  497. <td>View that will receive all mouse events until UngrabMouse is invoked.</td>
  498. </tr>
  499. </tbody>
  500. </table>
  501. <a id="Terminal_Gui_Application_Init_" data-uid="Terminal.Gui.Application.Init*"></a>
  502. <h4 id="Terminal_Gui_Application_Init_Terminal_Gui_ConsoleDriver_Terminal_Gui_IMainLoopDriver_" data-uid="Terminal.Gui.Application.Init(Terminal.Gui.ConsoleDriver,Terminal.Gui.IMainLoopDriver)">Init(ConsoleDriver, IMainLoopDriver)</h4>
  503. <div class="markdown level1 summary">
  504. Initializes a new instance of <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a> Application.
  505. </div>
  506. <div class="markdown level1 conceptual"></div>
  507. <h5 class="decalaration">Declaration</h5>
  508. <div class="codewrapper">
  509. <pre><code class="lang-csharp hljs">public static void Init(ConsoleDriver driver = null, IMainLoopDriver mainLoopDriver = null)</code></pre>
  510. </div>
  511. <h5 class="parameters">Parameters</h5>
  512. <table class="table table-bordered table-striped table-condensed">
  513. <thead>
  514. <tr>
  515. <th>Type</th>
  516. <th>Name</th>
  517. <th>Description</th>
  518. </tr>
  519. </thead>
  520. <tbody>
  521. <tr>
  522. <td><a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a></td>
  523. <td><span class="parametername">driver</span></td>
  524. <td></td>
  525. </tr>
  526. <tr>
  527. <td><a class="xref" href="Terminal.Gui.IMainLoopDriver.html">IMainLoopDriver</a></td>
  528. <td><span class="parametername">mainLoopDriver</span></td>
  529. <td></td>
  530. </tr>
  531. </tbody>
  532. </table>
  533. <h5 id="Terminal_Gui_Application_Init_Terminal_Gui_ConsoleDriver_Terminal_Gui_IMainLoopDriver__remarks">Remarks</h5>
  534. <div class="markdown level1 remarks">
  535. <p>
  536. Call this method once per instance (or after <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Shutdown">Shutdown()</a> has been called).
  537. </p>
  538. <p>
  539. Loads the right <a class="xref" href="Terminal.Gui.ConsoleDriver.html">ConsoleDriver</a> for the platform.
  540. </p>
  541. <p>
  542. Creates a <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> and assigns it to <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a>
  543. </p>
  544. </div>
  545. <a id="Terminal_Gui_Application_MakeCenteredRect_" data-uid="Terminal.Gui.Application.MakeCenteredRect*"></a>
  546. <h4 id="Terminal_Gui_Application_MakeCenteredRect_Terminal_Gui_Size_" data-uid="Terminal.Gui.Application.MakeCenteredRect(Terminal.Gui.Size)">MakeCenteredRect(Size)</h4>
  547. <div class="markdown level1 summary">
  548. Returns a rectangle that is centered in the screen for the provided size.
  549. </div>
  550. <div class="markdown level1 conceptual"></div>
  551. <h5 class="decalaration">Declaration</h5>
  552. <div class="codewrapper">
  553. <pre><code class="lang-csharp hljs">public static Rect MakeCenteredRect(Size size)</code></pre>
  554. </div>
  555. <h5 class="parameters">Parameters</h5>
  556. <table class="table table-bordered table-striped table-condensed">
  557. <thead>
  558. <tr>
  559. <th>Type</th>
  560. <th>Name</th>
  561. <th>Description</th>
  562. </tr>
  563. </thead>
  564. <tbody>
  565. <tr>
  566. <td><a class="xref" href="Terminal.Gui.Size.html">Size</a></td>
  567. <td><span class="parametername">size</span></td>
  568. <td>Size for the rectangle.</td>
  569. </tr>
  570. </tbody>
  571. </table>
  572. <h5 class="returns">Returns</h5>
  573. <table class="table table-bordered table-striped table-condensed">
  574. <thead>
  575. <tr>
  576. <th>Type</th>
  577. <th>Description</th>
  578. </tr>
  579. </thead>
  580. <tbody>
  581. <tr>
  582. <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
  583. <td>The centered rect.</td>
  584. </tr>
  585. </tbody>
  586. </table>
  587. <a id="Terminal_Gui_Application_Refresh_" data-uid="Terminal.Gui.Application.Refresh*"></a>
  588. <h4 id="Terminal_Gui_Application_Refresh" data-uid="Terminal.Gui.Application.Refresh">Refresh()</h4>
  589. <div class="markdown level1 summary">
  590. Triggers a refresh of the entire display.
  591. </div>
  592. <div class="markdown level1 conceptual"></div>
  593. <h5 class="decalaration">Declaration</h5>
  594. <div class="codewrapper">
  595. <pre><code class="lang-csharp hljs">public static void Refresh()</code></pre>
  596. </div>
  597. <a id="Terminal_Gui_Application_RequestStop_" data-uid="Terminal.Gui.Application.RequestStop*"></a>
  598. <h4 id="Terminal_Gui_Application_RequestStop" data-uid="Terminal.Gui.Application.RequestStop">RequestStop()</h4>
  599. <div class="markdown level1 summary">
  600. Stops running the most recent <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a>.
  601. </div>
  602. <div class="markdown level1 conceptual"></div>
  603. <h5 class="decalaration">Declaration</h5>
  604. <div class="codewrapper">
  605. <pre><code class="lang-csharp hljs">public static void RequestStop()</code></pre>
  606. </div>
  607. <h5 id="Terminal_Gui_Application_RequestStop_remarks">Remarks</h5>
  608. <div class="markdown level1 remarks">
  609. <p>
  610. This will cause <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_System_Func_System_Exception_System_Boolean__">Run(Func&lt;Exception, Boolean&gt;)</a> to return.
  611. </p>
  612. <p>
  613. Calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RequestStop">RequestStop()</a> is equivalent to setting the <a class="xref" href="Terminal.Gui.Toplevel.html#Terminal_Gui_Toplevel_Running">Running</a> property on the curently running <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> to false.
  614. </p>
  615. </div>
  616. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  617. <h4 id="Terminal_Gui_Application_Run_System_Func_System_Exception_System_Boolean__" data-uid="Terminal.Gui.Application.Run(System.Func{System.Exception,System.Boolean})">Run(Func&lt;Exception, Boolean&gt;)</h4>
  618. <div class="markdown level1 summary">
  619. Runs the application by calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean__">Run(Toplevel, Func&lt;Exception, Boolean&gt;)</a> with the value of <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Top">Top</a>
  620. </div>
  621. <div class="markdown level1 conceptual"></div>
  622. <h5 class="decalaration">Declaration</h5>
  623. <div class="codewrapper">
  624. <pre><code class="lang-csharp hljs">public static void Run(Func&lt;Exception, bool&gt; errorHandler = null)</code></pre>
  625. </div>
  626. <h5 class="parameters">Parameters</h5>
  627. <table class="table table-bordered table-striped table-condensed">
  628. <thead>
  629. <tr>
  630. <th>Type</th>
  631. <th>Name</th>
  632. <th>Description</th>
  633. </tr>
  634. </thead>
  635. <tbody>
  636. <tr>
  637. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Exception</span>, <span class="xref">System.Boolean</span>&gt;</td>
  638. <td><span class="parametername">errorHandler</span></td>
  639. <td></td>
  640. </tr>
  641. </tbody>
  642. </table>
  643. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  644. <h4 id="Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean__" data-uid="Terminal.Gui.Application.Run(Terminal.Gui.Toplevel,System.Func{System.Exception,System.Boolean})">Run(Toplevel, Func&lt;Exception, Boolean&gt;)</h4>
  645. <div class="markdown level1 summary">
  646. Runs the main loop on the given <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> container.
  647. </div>
  648. <div class="markdown level1 conceptual"></div>
  649. <h5 class="decalaration">Declaration</h5>
  650. <div class="codewrapper">
  651. <pre><code class="lang-csharp hljs">public static void Run(Toplevel view, Func&lt;Exception, bool&gt; errorHandler = null)</code></pre>
  652. </div>
  653. <h5 class="parameters">Parameters</h5>
  654. <table class="table table-bordered table-striped table-condensed">
  655. <thead>
  656. <tr>
  657. <th>Type</th>
  658. <th>Name</th>
  659. <th>Description</th>
  660. </tr>
  661. </thead>
  662. <tbody>
  663. <tr>
  664. <td><a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a></td>
  665. <td><span class="parametername">view</span></td>
  666. <td>The <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a> tu run modally.</td>
  667. </tr>
  668. <tr>
  669. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Exception</span>, <span class="xref">System.Boolean</span>&gt;</td>
  670. <td><span class="parametername">errorHandler</span></td>
  671. <td>Handler for any unhandled exceptions (resumes when returns true, rethrows when null).</td>
  672. </tr>
  673. </tbody>
  674. </table>
  675. <h5 id="Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean___remarks">Remarks</h5>
  676. <div class="markdown level1 remarks">
  677. <p>
  678. This method is used to start processing events
  679. for the main application, but it is also used to
  680. run other modal <a class="xref" href="Terminal.Gui.View.html">View</a>s such as <a class="xref" href="Terminal.Gui.Dialog.html">Dialog</a> boxes.
  681. </p>
  682. <p>
  683. To make a <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean__">Run(Toplevel, Func&lt;Exception, Boolean&gt;)</a> stop execution, call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RequestStop">RequestStop()</a>.
  684. </p>
  685. <p>
  686. Calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean__">Run(Toplevel, Func&lt;Exception, Boolean&gt;)</a> is equivalent to calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a>, followed by <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a>,
  687. and then calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_End_Terminal_Gui_Application_RunState_">End(Application.RunState)</a>.
  688. </p>
  689. <p>
  690. Alternatively, to have a program control the main loop and
  691. process events manually, call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Begin_Terminal_Gui_Toplevel_">Begin(Toplevel)</a> to set things up manually and then
  692. repeatedly call <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> with the wait parameter set to false. By doing this
  693. the <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_">RunLoop(Application.RunState, Boolean)</a> method will only process any pending events, timers, idle handlers and
  694. then return control immediately.
  695. </p>
  696. <p>
  697. When <code data-dev-comment-type="paramref" class="paramref">errorHandler</code> is null the exception is rethrown, when it returns true the application is resumed and when false method exits gracefully.
  698. </p>
  699. </div>
  700. <a id="Terminal_Gui_Application_Run_" data-uid="Terminal.Gui.Application.Run*"></a>
  701. <h4 id="Terminal_Gui_Application_Run__1_System_Func_System_Exception_System_Boolean__" data-uid="Terminal.Gui.Application.Run``1(System.Func{System.Exception,System.Boolean})">Run&lt;T&gt;(Func&lt;Exception, Boolean&gt;)</h4>
  702. <div class="markdown level1 summary">
  703. Runs the application by calling <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Run_Terminal_Gui_Toplevel_System_Func_System_Exception_System_Boolean__">Run(Toplevel, Func&lt;Exception, Boolean&gt;)</a> with a new instance of the specified <a class="xref" href="Terminal.Gui.Toplevel.html">Toplevel</a>-derived class
  704. </div>
  705. <div class="markdown level1 conceptual"></div>
  706. <h5 class="decalaration">Declaration</h5>
  707. <div class="codewrapper">
  708. <pre><code class="lang-csharp hljs">public static void Run&lt;T&gt;(Func&lt;Exception, bool&gt; errorHandler = null)
  709. where T : Toplevel, new()</code></pre>
  710. </div>
  711. <h5 class="parameters">Parameters</h5>
  712. <table class="table table-bordered table-striped table-condensed">
  713. <thead>
  714. <tr>
  715. <th>Type</th>
  716. <th>Name</th>
  717. <th>Description</th>
  718. </tr>
  719. </thead>
  720. <tbody>
  721. <tr>
  722. <td><span class="xref">System.Func</span>&lt;<span class="xref">System.Exception</span>, <span class="xref">System.Boolean</span>&gt;</td>
  723. <td><span class="parametername">errorHandler</span></td>
  724. <td></td>
  725. </tr>
  726. </tbody>
  727. </table>
  728. <h5 class="typeParameters">Type Parameters</h5>
  729. <table class="table table-bordered table-striped table-condensed">
  730. <thead>
  731. <tr>
  732. <th>Name</th>
  733. <th>Description</th>
  734. </tr>
  735. </thead>
  736. <tbody>
  737. <tr>
  738. <td><span class="parametername">T</span></td>
  739. <td></td>
  740. </tr>
  741. </tbody>
  742. </table>
  743. <a id="Terminal_Gui_Application_RunLoop_" data-uid="Terminal.Gui.Application.RunLoop*"></a>
  744. <h4 id="Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean_" data-uid="Terminal.Gui.Application.RunLoop(Terminal.Gui.Application.RunState,System.Boolean)">RunLoop(Application.RunState, Boolean)</h4>
  745. <div class="markdown level1 summary">
  746. Building block API: Runs the main loop for the created dialog
  747. </div>
  748. <div class="markdown level1 conceptual"></div>
  749. <h5 class="decalaration">Declaration</h5>
  750. <div class="codewrapper">
  751. <pre><code class="lang-csharp hljs">public static void RunLoop(Application.RunState state, bool wait = true)</code></pre>
  752. </div>
  753. <h5 class="parameters">Parameters</h5>
  754. <table class="table table-bordered table-striped table-condensed">
  755. <thead>
  756. <tr>
  757. <th>Type</th>
  758. <th>Name</th>
  759. <th>Description</th>
  760. </tr>
  761. </thead>
  762. <tbody>
  763. <tr>
  764. <td><a class="xref" href="Terminal.Gui.Application.RunState.html">Application.RunState</a></td>
  765. <td><span class="parametername">state</span></td>
  766. <td>The state returned by the Begin method.</td>
  767. </tr>
  768. <tr>
  769. <td><span class="xref">System.Boolean</span></td>
  770. <td><span class="parametername">wait</span></td>
  771. <td>By default this is true which will execute the runloop waiting for events, if you pass false, you can use this method to run a single iteration of the events.</td>
  772. </tr>
  773. </tbody>
  774. </table>
  775. <h5 id="Terminal_Gui_Application_RunLoop_Terminal_Gui_Application_RunState_System_Boolean__remarks">Remarks</h5>
  776. <div class="markdown level1 remarks">
  777. Use the wait parameter to control whether this is a
  778. blocking or non-blocking call.
  779. </div>
  780. <a id="Terminal_Gui_Application_Shutdown_" data-uid="Terminal.Gui.Application.Shutdown*"></a>
  781. <h4 id="Terminal_Gui_Application_Shutdown" data-uid="Terminal.Gui.Application.Shutdown">Shutdown()</h4>
  782. <div class="markdown level1 summary">
  783. Shutdown an application initialized with <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Init_Terminal_Gui_ConsoleDriver_Terminal_Gui_IMainLoopDriver_">Init(ConsoleDriver, IMainLoopDriver)</a>
  784. </div>
  785. <div class="markdown level1 conceptual"></div>
  786. <h5 class="decalaration">Declaration</h5>
  787. <div class="codewrapper">
  788. <pre><code class="lang-csharp hljs">public static void Shutdown()</code></pre>
  789. </div>
  790. <a id="Terminal_Gui_Application_UngrabMouse_" data-uid="Terminal.Gui.Application.UngrabMouse*"></a>
  791. <h4 id="Terminal_Gui_Application_UngrabMouse" data-uid="Terminal.Gui.Application.UngrabMouse">UngrabMouse()</h4>
  792. <div class="markdown level1 summary">
  793. Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.
  794. </div>
  795. <div class="markdown level1 conceptual"></div>
  796. <h5 class="decalaration">Declaration</h5>
  797. <div class="codewrapper">
  798. <pre><code class="lang-csharp hljs">public static void UngrabMouse()</code></pre>
  799. </div>
  800. </article>
  801. </div>
  802. <div class="hidden-sm col-md-2" role="complementary">
  803. <div class="sideaffix">
  804. <div class="contribution">
  805. <ul class="nav">
  806. </ul>
  807. </div>
  808. <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
  809. <h5>In This Article</h5>
  810. <div></div>
  811. </nav>
  812. </div>
  813. </div>
  814. </div>
  815. </div>
  816. <footer>
  817. <div class="grad-bottom"></div>
  818. <div class="footer">
  819. <div class="container">
  820. <span class="pull-right">
  821. <a href="#top">Back to top</a>
  822. </span>
  823. <span>Generated by <strong>DocFX</strong></span>
  824. </div>
  825. </div>
  826. </footer>
  827. </div>
  828. <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
  829. <script type="text/javascript" src="../../styles/docfx.js"></script>
  830. <script type="text/javascript" src="../../styles/main.js"></script>
  831. </body>
  832. </html>