General Rules
Tip
You MUST read the cited hyperlink before you do the job. ASK if you think the hyperlink is not work.
Handle Message and Exception
If message is well-managed, apply MessageKit to show the message; if the message is Exception, apply ExceptionUtil.ShowException(Exception, object) to show the exception for detail treatment. The messages are shown in Bottom Message Bar on Main Panel.
For examples of message and exception handling patterns:
- Normal message handling:
MessageKit.AddMessage("Operation completed successfully.");
MessageKit.AddWarning("Please check your input.");
- Exception handling in synchronous code:
try
{
// Your code here
throw new NotImplementedException("Demo exception");
}
catch (Exception ex)
{
ExceptionUtil.ShowException(ex, null);
}
- Exception handling in asynchronous code:
await Task.Run(() =>
{
// Your async operation here
throw new NotImplementedException("Demo async exception");
}).ShowIfCatched(null);
Loose Manner
Run Skippable Rapid Calling Synchronous Action in Loose Manner.
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 LooseRunner and apply LooseRunner.TryRun(Action<CancellationToken>) to run the action.
Dispose the LooseRunner on owner disposing to ensure the tryrun action is well-managed.
GUI File Path Assignment
Translation Remarks
See Translation Remarks.