Message Section on Main Panel
Initialize MessageHost.Default with Message Section
To show and save the message on Brief Message Text Field, add event to Default.OnAdding.
The event contains:
- update the text content of
Brief Message Text Field - Append the message to log file (create if not existed)
$"logs/log-{DateTime.Now:yyyy-MM-dd}.txt"
Tip
- Handle the situation that logs over one day.
- Check if passing argument of
OnAddingevent is Exception. If the it is Exception, update text content by Message but log to file with the full Exception information. - Consider MessageFlag to set the behavior of Message Section. For example, apply alert style if passing argument is exception. The Info (and the other flags that the priority lower than it) should only record in the logs but not shows in the Message Section.
WPF Application Layout
- Message Section Bottom Bar
- Brief Message Text Field
- Show Log Button
Tip
The text field should be selectable to let user easy to copy the message.
Web Page Application Layout
- Message Section Stacking Toast
- Brief Message Text Field
Enable toast Auto-Hide only if the message level is low.
Note
The convention of web page is not like WPF panel. Use Boostrap or Bootstrap-like toast. They are much appropriate than the fixed bottom bar on WPF.
Log Page Layout
- Head Line
- Log Label
- Show Log Button
- Download Log Button
- Log TextArea
Behavior of Show Log Button
Call an editor (or reader, bootstrap modal like poping block) to show the current log.
Tip
Handle the situation that the current log file does not exist. It may occurs if no message has added.