Welcome Guest, you are in: Login

FDOT Wiki

RSS RSS

GisFramework



Search the wiki
»
The IInitialMessageProvider is an interface that allows custom messages to be provided to the InitialMessagesAction. The implemented IInitialMessageProvider is then configured for the InitialMessagesAction. To be usable the IInitialMessageProvider must be exportable from MEF as typeof(IInitialMessageProvider).

Table of Contents [Hide/Show]


Members
         Events
         Methods
         Properties
Implemented Example
See Also


Members

Here is the methods,properties, and events that need to be implemented on the interface.

Events

NameDescription
MessagesLoadedThis event must be raised to signal to the startupAction the messages are loaded by the provider. Failure to do this will hang the application at the point of message loading.

Methods

NameReturn TypeDescription
LoadMessages()voidThis method is called by the InitialMessagesAction to have the provider initiate the loading of messages. The logic of loading messages should be located inside this method.

Properties

NameTypeDescription
InitialMessagesIEnumerable<IInitialMessage>This is where the IInitialMessages that are loaded are set for reading by the InitialMessagesAction.

Implemented Example

    [Export(typeof(IInitialMessageProvider))]
    public class OvpInitialMessageProvider:IInitialMessageProvider
    {
        private readonly List<IInitialMessage> _initialMessages = new List<IInitialMessage>();
        public IEnumerable<IInitialMessage> InitialMessages
        {
            get { return _initialMessages; }
        }

        public void LoadMessages()
        {
            var binding = new BasicHttpBinding();
            
            var address = new EndpointAddress(new Uri("http://localhost/ovpcomponents/OvpGisService.svc"));
            var svs = new OvpGisService.OvpGisServiceClient(binding, address);

            svs.GetGeneralMessagesCompleted += SvsGetGeneralMessagesCompleted;
            svs.GetGeneralMessagesAsync();
        }

        void SvsGetGeneralMessagesCompleted(object sender, OvpGisService.GetGeneralMessagesCompletedEventArgs e)
        {
            _initialMessages.Add(new InitialMessage
                                     {
                                         HeadingText="General Messages",
                                         Messages=e.Result.OrderBy(o=>o.MessageOrder).Select(s=>s.MessageText)
                                     });

            MessagesLoaded(this, null);
        }

        public event EventHandler MessagesLoaded;
    }

See Also

Any Questions or Comments? Email
Some of the icons created by FamFamFam.