source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet/RemoteEventService.cs@ 1800

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

Initial Import of BMX4

File size: 6.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Windows.Forms;
5
6namespace IndianHealthService.BMXNet
7{
8 /// <summary>
9 /// All async communications with RPMS is performed through the RemoteEventService which
10 /// is found by calling aRemoteSession.EventServices.
11 /// </summary>
12 /// <remarks>
13 /// <list>
14 /// <para>By default remote events are asynchronous and are not on the UI thread. The development
15 /// must handed the events propertly and if interacting with a user interface control must use
16 /// Invoke(). As a convinenence, InvokedControl can be set to any non-disposed Control and the
17 /// event service is use Invoke() so that the event is triggered on the UI thread</para>
18 /// <para>The Event timer, IsEventPollingEnabled and EventPollingInterval, is used by the Async RPC calls
19 /// and is automattically turned on with IsEventPollingEnabled. If the developer turns on polling or
20 /// changes the EventPollingInterval to be a long period, then the Async RPC calls will not respond in
21 /// a timely manner if at all.
22 /// </para>
23 /// </list>
24 /// </remarks>
25 public interface RemoteEventService
26 {
27 /// <summary>
28 /// This event is triggered when an event named anEventType is published and the
29 /// receiver has a subscription. Remember that this event is not on the UI-thread unless InvokedControl is properly set.
30 /// </summary>
31 event EventHandler<RemoteEventArgs> RpmsEvent;
32
33 /// <summary>
34 /// This event is triggered every time the event timer is triggered, based on the EventPollingInterval.
35 /// Remember that this event is not on the UI-thread unless InvokedControl is properly set.
36 /// </summary>
37 /// <remarks>
38 /// Respond quickly to this event.
39 /// </remarks>
40 event EventHandler TimerEvent;
41
42 /// <summary>
43 /// Set InvokedControl to a form or control of your WinForm application or EHR/VueCentric component that
44 /// will live the lifetime of your RemoteSession. The RemoteEventServices will Invoke() on the InvokedControl
45 /// to ensure all events are triggered on the UI thread.
46 /// </summary>
47 Control InvokedControl { get; set; }
48
49
50 /// <summary>
51 /// Subscribe to an event named anEventType. These events are trigger exclusivley by other BMXNet remote services and
52 /// travel from client-to-server-to-client. Once subscribed, the RemoteSession will poll based on the EventPollingInterval to
53 /// see if a server-side event is waiting to be triggered on the client.
54 /// </summary>
55 /// <param name="anEventType">The name of the event to subscribe to</param>
56 /// <returns>1 if successful, otherwise it's an error. Refer to KIDS source for error codes.</returns>
57 int Subscribe(String anEventType);
58
59 /// <summary>
60 /// Unsubscribe from an event named anEventType. Once unsubscribed, published events named anEventType will no longer
61 /// trigger an event for this RemoteSession.
62 /// </summary>
63 /// <param name="anEventType">The name of the event to unsubscribe from</param>
64 /// <returns>1 if successful, otherwise it's an error. Refer to KIDS source for error codes.</returns>
65 int Unsubscribe(String anEventType);
66
67 /// <summary>
68 /// Access to a RemoteEventService also allows you to publish your own events. Publishing is done through design and
69 /// documentation to notify other developers what events you will trigger. An event is published, or triggered, by using TriggerEvent
70 /// with the name of the event, an optional event specific string with data, and whether or not the publisher, if subsubscribed,
71 /// wants the event published to them.
72 /// </summary>
73 /// <param name="anEventType">Name of the event to publish</param>
74 /// <param name="aParameter">An optional string with event specific data</param>
75 /// <param name="raiseBack">Set to True if the publisher of anEventType, that is also a subscriber to anEventType,
76 /// also wants the event to be triggered back to them</param>
77 /// <returns></returns>
78 int TriggerEvent(String anEventType, String aParameter,bool raiseBack);
79
80 /// <summary>
81 /// EventPolling is used for RemoteService events and Async RPC calls. IsEventPollingEnabled is used
82 /// to turn polling on and off: True for on and False for off. The Async RPC framework and remote event service
83 /// needs polling to be turned on.
84 /// </summary>
85 /// <remarks>
86 /// If Async RPC's or remote events are not working debug the RemoteEventService to verify polling is enabled
87 /// and configured.
88 /// </remarks>
89 /// <example>
90 /// If using Async RPC or remote service events activate and configure the timer when your applications starts
91 /// <code>
92 /// ... //Poll every 10000 ms, or 10 seconds
93 /// this.RemoteSession.EventServices.EventPollingInterval=10000;
94 /// this.RemoteSession.EventServices.IsEventPollingEnabled=True;
95 /// ...
96 /// ... //Perhaps in another part of your application you have a small active Chat Window
97 /// ... //Increase the frequency of polling by decreasing the EventPollingInterval to every 2 seconds
98 /// this.RemoteSession.EventServices.EventPollingInterval=2000;
99 /// </code>
100 /// </example>
101 bool IsEventPollingEnabled { get; set; }
102
103 /// <summary>
104 /// The number of milliseconds (ms) to wait before polling. If a polling event is currently being processed
105 /// when a second event is trigger, the second event is skipped. It's recommended to keep this interval at
106 /// 5000 (5 seconds) or higher.
107 /// </summary>
108 int EventPollingInterval { get; set; }
109 }
110}
Note: See TracBrowser for help on using the repository browser.