This commit is contained in:
2025-12-05 16:33:37 +08:00
parent dbbe3303b3
commit 9de88d2db0
163 changed files with 5633 additions and 2293 deletions
@@ -92,13 +92,13 @@
<p>You MUST read the cited hyperlink before you do the job. ASK if you think the hyperlink is not work.</p>
</div>
<h2 id="handle-message-and-exception">Handle Message and Exception</h2>
<p>If message is well-managed, apply <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html">MessageKit</a> to show the message; if the message is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>, apply <a class="xref" href="../../../api/Hi.Common.ExceptionUtil.html">ExceptionUtil</a>.<a class="xref" href="../../../api/Hi.Common.ExceptionUtil.html#Hi_Common_ExceptionUtil_ShowException_System_Exception_System_Object_">ShowException(Exception, object)</a> to show the exception for detail treatment. The messages are shown in <a href="message-section-on-main-panel.html">Message Section on Main Panel</a>.</p>
<p>If message is well-managed, apply &lt;xref:Hi.Common.Messages.MessageKit&gt; to show the message; if the message is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>, apply <a class="xref" href="../../../api/Hi.Common.ExceptionUtil.html">ExceptionUtil</a>.<a class="xref" href="../../../api/Hi.Common.ExceptionUtil.html#Hi_Common_ExceptionUtil_ShowException_System_Exception_System_Object_">ShowException(Exception, object)</a> to show the exception for detail treatment. The messages are shown in <a href="message-section-on-main-panel.html">Message Section on Main Panel</a>.</p>
<p>For examples of message and exception handling patterns:</p>
<ol>
<li>Normal message handling:</li>
</ol>
<pre><code class="lang-csharp" name="Normal Messages">MessageKit.AddMessage(&quot;Operation completed successfully.&quot;);
MessageKit.AddWarning(&quot;Please check your input.&quot;);
<pre><code class="lang-csharp" name="Normal Messages">MessageHost.AddMessage(&quot;Operation completed successfully.&quot;);
MessageHost.AddWarning(&quot;Please check your input.&quot;);
</code></pre>
<ol start="2">
<li>Exception handling in synchronous code:</li>
@@ -125,7 +125,7 @@ catch (Exception ex)
<p>The examples are in project Hi.Sample. See <a href="index.html">this page</a> for git repository.</p>
<h2 id="loose-manner">Loose Manner</h2>
<p>Run Skippable Rapid Calling Synchronous Action in Loose Manner.</p>
<p>Some synchronous action may be calling rapidly but only the last call has to be effective (or it is endurable to loss some previous action call). Define a <a class="xref" href="../../../api/Hi.Common.LooseRunner.html">LooseRunner</a> and apply <a class="xref" href="../../../api/Hi.Common.LooseRunner.html">LooseRunner</a>.&lt;xref:Hi.Common.LooseRunner.TryRun(System.Action{System.Threading.CancellationToken})&gt; to run the action.</p>
<p>Some synchronous action may be calling rapidly but only the last call has to be effective (or it is endurable to loss some previous action call). Define a <a class="xref" href="../../../api/Hi.Common.LooseRunner.html">LooseRunner</a> and apply <a class="xref" href="../../../api/Hi.Common.LooseRunner.html#Hi_Common_LooseRunner_TryRun_">TryRun</a> to run the action.</p>
<p>Dispose the <a class="xref" href="../../../api/Hi.Common.LooseRunner.html">LooseRunner</a> on owner disposing to ensure the tryrun action is well-managed.</p>
<h2 id="gui-file-path-assignment">GUI File Path Assignment</h2>
<p>See <a href="widget/gui-file-path-assignment.html">GUI File Path Assignment</a>.</p>