This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2026-09-09 17:35:23 +08:00

158 lines
8.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Conventions | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Conventions | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Anatomy-GeneralRules">
<h1 id="conventions">Conventions</h1>
<p>The rules and shared contracts every Anatomy page assumes. A page in this folder describes
something that is true across screens rather than something a reader can point at: how a message
reaches the user, how a control behaves when its model is wrong, how a file path is stored, how a
component releases what it indexed on the server.</p>
<p>Ordered from the rules that bind every page in both applications, through the two shared UI
contracts, down to the service patterns and the canvas transport beneath them.</p>
<h2 id="rules-that-bind-every-page">Rules That Bind Every Page</h2>
<h3 id="message-and-exception-handling">Message and Exception Handling</h3>
<p>HiNC uses three independent message categories: <strong>Diagnostic</strong> (<code>IProgress&lt;object&gt;</code>), <strong>UI
Notification</strong> (<code>MessageBoardUtil</code>), and <strong>App Log</strong> (<code>ILogger</code>). See
<a class="xref" href="../../technique/api-foundations/message-management.html">Message Management</a> for the full design pattern.</p>
<p>For async exception handling, use <code>CatchExceptions</code> with a caller-provided handler:</p>
<pre><code class="lang-csharp">await task.CatchExceptions(ex =&gt; progress?.Report(ex));
</code></pre>
<p>The <a class="xref" href="../shell/bottom-message-bar.html">Bottom Message Bar</a> displays UI-level notifications. The
<a class="xref" href="../shell/session-message-panel.html">Session Message Panel</a> displays session diagnostic messages.</p>
<h3 id="loose-manner">Loose Manner</h3>
<p>The Loose Manner pattern handles rapidly-called synchronous actions where only the last call needs
to be effective.</p>
<p>The <a class="xref" href="../../api/Hi.Common.LooseRunner.html">LooseRunner</a> class manages skippable rapid-calling synchronous actions. When an
action is called rapidly, only the last call is executed while previous calls are safely skipped.
The <a class="xref" href="../../api/Hi.Common.LooseRunner.html#Hi_Common_LooseRunner_TryRun_">TryRun</a> method is used to execute actions in this manner.</p>
<p>The <a class="xref" href="../../api/Hi.Common.LooseRunner.html">LooseRunner</a> should be disposed when its owner is disposed to ensure proper
resource cleanup.</p>
<h3 id="loose-couple">Loose Couple</h3>
<p>If the model of a UI component is null or mismatched, apply a status badge instead of throwing an
exception, so the rest of the UI keeps working.</p>
<h2 id="pages">Pages</h2>
<ul>
<li><a href="translation-remarks.html">Translation Remarks</a> — The terminology every translated UI label is held to, so the same concept keeps the same word across screens and languages</li>
<li><a href="gui-file-path-assignment.html">GUI File Path Assignment</a> — How a control stores a chosen file: relative to the configuration directory when it sits inside it, absolute when it does not</li>
<li><a href="numeric-io-utilities.html">Numeric Input/Output Utilities</a> — Handling Infinity, -Infinity and NaN across the JavaScript / C# boundary, where plain JSON cannot carry them</li>
<li><a href="dictionary-service-pattern.html">DictionaryService and DictionaryHub Pattern</a> — Connection-scoped indexing that lets a hierarchical component reference a backend object across hub connections</li>
<li><a href="webapi-hub-cleanup-pattern.html">Webapi with Hub-Cleanup Assistance Pattern</a> — Which component owns an index key and where it releases it, so a component never cleans a key it did not create</li>
<li><a href="rendering-canvas-web-service.html">Rendering Canvas on the Web Service</a> — The SignalR transport that puts a server-rendered 3D canvas on a browser page</li>
</ul>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="../platform/index.html">Platform</a> — the other cross-screen folder: the machinery these rules are applied on top of, including the host process that starts HiAPI</li>
<li><a href="../shell/index.html">App Shell</a> — the window frame these conventions are applied inside</li>
<li><a href="../widget/index.html">Widgets</a> — the reusable controls that implement two of them</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>