Create the abstract API

  • You have created a new project, called Notification (FourthCoffee.Framework.Notification.dll), which will contain the API for our application block, as well as a single provider. You have created skeleton files for all the files you need to implement.
  • Open the file INotificationProvider.cs in the Notification project. Add the following interface within the namespace. This will be our provider interface.
    /// <summary>
    /// Interface exposed by any provider that supports notification
    /// </summary>
    public interface INotificationProvider : IConfigurationProvider
    {
        /// <summary>
        /// Display a message to the user.
        /// This method must not block execution, so if the message display
        /// will take any length of time, it should occur asynchronously.
        /// </summary>
        /// <param name="parent">The parent form to use when displaying the message</param>
        /// <param name="message">The message to display to the user</param>
        void DisplayMessage(Form parent, string message);
    }
    Note that the provider interface derives from IConfigurationProvider. This ensures that any implementation of the provider can be initialized through configuration. It also means, however, that all clients of this API must also add a reference to the Configuration assembly.