How to add error messages that appear during processing
When
error.FileState.csZonal-OCR is processing files it will display this big red box if an error occurs. If you ever need to add a new type of message that should appear, follow these instructions.Required Files to Update
FileState.cs
Add an enum value for your newerror- occurs.
FileStateToHintConverter.cs
Add- addthe textforthat will be displayed when the errormessage - the <Style TargetType="{x:Type userControls:ErrorMessage}"> tag. Add a child <DataTrigger> tag for your new FileState enum
FileStatisticsModel.cs
Add your new enum to the FailedCount getter.Windows Notification
If you want your error to also appear as a Windows notification (which is probably what you want), you also need to make this change.
TrayNotificationHelper.cs
- add
Add your new enum to the errorsStatelistlist.(OPTIONALTriggering
-theifErroryouAll
wantthat's left is to trigger the error at the appropriate time. Simply set the FileState property on the FileView model toappeartheasvaluewindows notification) - The
FileStatisticsMode.cs - addof your newenumenum.The red error box will automatically appear because its text value is bound to the
FailedCountFileView.getterWindows - notification
FormsOcr.ResourceDictionary.xamlwill-automaticallyaddappeara child <DataTrigger> tag tobecause theuserControls:ErrorMessageFileState<Style>settertagnotifies the TrayNotificationHelper of its new value.References
See commit {something} in the ZonalOCR git repository for
yourannew enum Set FileState to your error message. An event is triggered that will take care of displaying everything
FormsOcr.ResourceDictionary.xaml
Find