source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet/LocalEventService.cs@ 1172

Last change on this file since 1172 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 4.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace IndianHealthService.BMXNet
6{
7
8 /// <summary>
9 /// Access to local services are access through this interface.
10 /// </summary>
11 public interface LocalEventService
12 {
13 /// <summary>
14 /// Subscribe to the local event named anEventName.
15 /// </summary>
16 /// <remarks>
17 /// To receive published events, handle the ApplicationEvent. If you explicity subscript
18 /// to the "REFRESH" event then both RefreshRequested and ApplicationEvent will be triggers.
19 /// </remarks>
20 /// <param name="anEventName">The name of the event. This name should be shared and wellknown between many components.</param>
21 void Subscribe(String anEventName);
22
23 /// <summary>
24 /// Checks to see there are any subscriptions for this event.
25 /// </summary>
26 /// <remarks>
27 /// If publishing an event, there is no need to first check if there are subscribers unless there is a
28 /// performance hit for the application to Trigger the event.
29 /// </remarks>
30 /// <param name="anEventName">The name of the event checking to see if it's been subscribed already.</param>
31 /// <returns></returns>
32 bool HasSubscribers(String anEventName);
33
34
35 /// <summary>
36 /// Unscribe scribes from the event. It is not mandatory to unsubscribe from this event at the end of
37 /// your object's lifecycle but you should either subsubscribe or remote the event handler.
38 /// </summary>
39 /// <param name="anEventName">The name of the event unsubscribing from.</param>
40 /// <returns></returns>
41 void Unsubscribe(String anEventName);
42
43 /// <summary>
44 /// This commonly broadcasted event is request to refresh content.
45 /// </summary>
46 /// <remarks>
47 /// In the EHR, this is equivalent to the "REFRESH" event. The WinFramework also uses "REFRESH" as the
48 /// event name for triggering a refresh request.
49 /// </remarks>
50 /// <example>
51 /// The following code from Well Child Module's Growth Chart shows registering for the Refresh event
52 /// at startup:
53 /// <code>
54 /// public void Startup()
55 /// {
56 /// this.LocalSession.EventServices.RefreshRequested += new EventHandler(Session_RefreshRequested);
57 /// }
58 ///
59 /// void Session_RefreshRequested(object sender, EventArgs e)
60 /// {
61 /// this.RefreshAll();
62 /// }
63 ///</code>
64 ///
65 /// </example>
66 event EventHandler RefreshRequested;
67
68
69 /// <summary>
70 /// Local event subscribers will have this event triggered.
71 /// </summary>
72 /// <remarks>
73 /// The "REFRESH" event is filtered out and is triggered using the RefreshRequested event
74 /// </remarks>
75 /// <example>
76 /// The Well Child Module growth chart displays Height and Weight. When the EHR vitals component adds
77 /// new Heights and Weights it publishes a LocalEvent with an EventType PCC*MSR. If the growth chart detects
78 /// the Vitals update event it then refreshes the growth chart:
79 /// <code>
80 /// public void Startup()
81 /// {
82 /// this.LocalSession.EventServices.ApplicationEvent+= new EventHandler&lt;LocalEventArgs&gt;(Session_ApplicationEvent);
83 /// }
84 ///
85 ///
86 /// void Session_ApplicationEvent(object sender, LocalEventArgs e)
87 /// {
88 /// if (this.IsVitalsUpdatedEvent(e))
89 /// {
90 /// this.RefreshAll();
91 /// }
92 /// }
93 ///
94 /// protected bool IsVitalsUpdatedEvent(LocalEventArgs anEvent)
95 /// {
96 /// return anEvent.EventType.StartsWith("PCC") &amp;&amp; anEvent.EventType.EndsWith("MSR");
97 /// }
98 /// </code>
99 /// </example>
100 event EventHandler<LocalEventArgs> ApplicationEvent;
101
102 /// <summary>
103 /// To publish an event call TriggerEvent with the event name and optional details. There is no
104 /// restriction on what local events that can be triggered. A "REFRESH" event can be broadcast as
105 /// well as any other application specific or well-known loal event.
106 /// </summary>
107 /// <param name="anEventName">The event name. This is normally a well-known event that multiple components used for event-driven communications.</param>
108 /// <param name="someDetails">An arbitrary string containing event specific data</param>
109 void TriggerEvent(String anEventName, String someDetails);
110 }
111}
112
113
Note: See TracBrowser for help on using the repository browser.