Skip to main content

How to add error messages that appear during processing

    image.png

  • When

    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 new error

    error.

  • FileStateToHintConverter.cs
    Add - addthe text forthat will be displayed when the error message

    occurs.

  • FormsOcr.ResourceDictionary.xaml
    Find

  • 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

    image.png

    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 errorsState listlist.

    (OPTIONAL
    Triggering -the ifError
    you

    All wantthat's left is to trigger the error at the appropriate time. Simply set the FileState property on the FileView model to appearthe asvalue windows notification)

  • FileStatisticsMode.cs - addof your new enumenum.

    The red error box will automatically appear because its text value is bound to the FailedCountFileView. getter

    The
  • Windows
  • notification
    FormsOcr.ResourceDictionary.xamlwill -automatically addappear a child <DataTrigger> tag tobecause the userControls:ErrorMessageFileState <Style>setter tagnotifies the TrayNotificationHelper of its new value.

    References

    See commit {something} in the ZonalOCR git repository for youran new enum

  • Set FileState to your error message. An event is triggered that will take care of displaying everything
example.