tune
This commit is contained in:
@@ -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 <xref:Hi.Common.Messages.MessageKit> 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("Operation completed successfully.");
|
||||
MessageKit.AddWarning("Please check your input.");
|
||||
<pre><code class="lang-csharp" name="Normal Messages">MessageHost.AddMessage("Operation completed successfully.");
|
||||
MessageHost.AddWarning("Please check your input.");
|
||||
</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>.<xref:Hi.Common.LooseRunner.TryRun(System.Action{System.Threading.CancellationToken})> 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>
|
||||
|
||||
@@ -156,11 +156,11 @@ Users can refresh the log content or download the current day's log file for off
|
||||
<p>The <code>Project</code> Menu Managing <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>.</p>
|
||||
<p>To <code>New</code> (create), <code>Save</code> and <code>Save As</code> the <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>, See <a class="xref" href="../../sample/Sample.Machining.DemoBuildGeomOnlyMachiningProject.html">DemoBuildGeomOnlyMachiningProject</a> for the example.</p>
|
||||
<p>To <code>Load</code> <a class="xref" href="../../../api/Hi.MachiningProcs.MachiningProject.html">MachiningProject</a>, See <a class="xref" href="../../sample/Sample.Machining.DemoUseMachiningProject.html">DemoUseMachiningProject</a> for the example.</p>
|
||||
<p>Show message for the actions result (successed or has exception) by <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html">MessageKit</a>.</p>
|
||||
<p>Show message for the actions result (successed or has exception) by <xref:Hi.Common.Messages.MessageKit>.</p>
|
||||
<div class="TIP">
|
||||
<h5>Tip</h5>
|
||||
<p>Recommmand using static function of <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html">MessageKit</a> to do the job.
|
||||
Read document of <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html">MessageKit</a> to ensure the proper usage.</p>
|
||||
<p>Recommmand using static function of <xref:Hi.Common.Messages.MessageKit> to do the job.
|
||||
Read document of <xref:Hi.Common.Messages.MessageKit> to ensure the proper usage.</p>
|
||||
</div>
|
||||
<p>On project loaded (<code>Navigation Menu</code>/<code>Project</code>/<code>Load MenuItem</code>)
|
||||
, set the Player.Panel.RenderingCanvas.DispEngine to <a class="xref" href="../../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToIsometricView">SetViewToIsometricView()</a>.</p>
|
||||
|
||||
+3
-3
@@ -87,8 +87,8 @@
|
||||
<article data-uid="">
|
||||
<h1 id="message-section-on-main-panel">Message Section on Main Panel</h1>
|
||||
|
||||
<h2 id="initialize--with-message-section">Initialize <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html">MessageKit</a>.<a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html#Hi_Common_Messages_MessageKit_Default">Default</a> with Message Section</h2>
|
||||
<p>To show and save the message on <code>Brief Message Text Field</code>, add event to <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html#Hi_Common_Messages_MessageKit_Default">Default</a>.<a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html#Hi_Common_Messages_MessageKit_OnAdding">OnAdding</a>.</p>
|
||||
<h2 id="initialize--with-message-section">Initialize <xref:Hi.Common.Messages.MessageKit>.<xref:Hi.Common.Messages.MessageKit.Default> with Message Section</h2>
|
||||
<p>To show and save the message on <code>Brief Message Text Field</code>, add event to <xref:Hi.Common.Messages.MessageKit.Default>.<xref:Hi.Common.Messages.MessageKit.OnAdding>.</p>
|
||||
<p>The event contains:</p>
|
||||
<ul>
|
||||
<li>update the text content of <code>Brief Message Text Field</code></li>
|
||||
@@ -98,7 +98,7 @@
|
||||
<h5>Tip</h5>
|
||||
<ul>
|
||||
<li>Handle the situation that logs over one day.</li>
|
||||
<li>Check if passing argument of <a class="xref" href="../../../api/Hi.Common.Messages.MessageKit.html#Hi_Common_Messages_MessageKit_OnAdding">OnAdding</a> is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>. If the it is Exception, update text content by <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>.<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception.message">Message</a> but log to file with the full Exception information.</li>
|
||||
<li>Check if passing argument of <xref:Hi.Common.Messages.MessageKit.OnAdding> is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>. If the it is Exception, update text content by <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a>.<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.exception.message">Message</a> but log to file with the full Exception information.</li>
|
||||
<li>Consider <a class="xref" href="../../../api/Hi.Common.Messages.MessageFlag.html">MessageFlag</a> to set the behavior of Message Section. For example, apply alert style if passing argument is exception. The <a class="xref" href="../../../api/Hi.Common.Messages.MessageFlag.html#Hi_Common_Messages_MessageFlag_Info">Info</a> (and the other flags that the priority lower than it) should only record in the logs but not shows in the Message Section.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageKit.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
@@ -392,7 +392,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageKit.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
@@ -549,7 +549,7 @@ namespace HiNC_2025_win_desktop.Geom
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常但不中断用户操作
|
||||
MessageKit.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
MessageHost.AddError(string.Format(Application.Current.FindResource("Vec3d_Update_Error").ToString(), ex.Message));
|
||||
ex.ShowException(this);
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user