author | sl |
Sun, 31 Aug 2014 16:21:50 +0200 | |
changeset 50 | ba4cad33db58 |
parent 32 | 4c416d2878dd |
child 55 | b5ed2e29be23 |
permissions | -rw-r--r-- |
sl@24 | 1 |
using System; |
sl@24 | 2 |
using System.Collections.Generic; |
sl@24 | 3 |
using System.Linq; |
sl@24 | 4 |
using System.Text; |
sl@24 | 5 |
using System.Threading.Tasks; |
sl@24 | 6 |
using System.ServiceModel; |
sl@24 | 7 |
using System.Collections; |
sl@43 | 8 |
using System.Drawing; |
sl@43 | 9 |
using System.Runtime.Serialization; |
sl@24 | 10 |
|
sl@24 | 11 |
|
sl@24 | 12 |
namespace SharpDisplayInterface |
sl@24 | 13 |
{ |
sl@43 | 14 |
[DataContract] |
sl@43 | 15 |
public class TextField |
sl@43 | 16 |
{ |
sl@43 | 17 |
public TextField() |
sl@43 | 18 |
{ |
sl@43 | 19 |
Index = 0; |
sl@43 | 20 |
Text = ""; |
sl@43 | 21 |
Alignment = ContentAlignment.MiddleLeft; |
sl@43 | 22 |
} |
sl@43 | 23 |
|
sl@43 | 24 |
public TextField(int aIndex, string aText = "", ContentAlignment aAlignment = ContentAlignment.MiddleLeft) |
sl@43 | 25 |
{ |
sl@43 | 26 |
Index = aIndex; |
sl@43 | 27 |
Text = aText; |
sl@43 | 28 |
Alignment = aAlignment; |
sl@43 | 29 |
} |
sl@43 | 30 |
|
sl@43 | 31 |
[DataMember] |
sl@43 | 32 |
public int Index { get; set; } |
sl@43 | 33 |
|
sl@43 | 34 |
[DataMember] |
sl@43 | 35 |
public string Text { get; set; } |
sl@43 | 36 |
|
sl@43 | 37 |
[DataMember] |
sl@43 | 38 |
public ContentAlignment Alignment { get; set; } |
sl@43 | 39 |
} |
sl@43 | 40 |
|
sl@43 | 41 |
|
sl@30 | 42 |
[ServiceContract( CallbackContract = typeof(IDisplayServiceCallback), |
sl@30 | 43 |
SessionMode = SessionMode.Required)] |
sl@24 | 44 |
public interface IDisplayService |
sl@24 | 45 |
{ |
sl@32 | 46 |
/// <summary> |
sl@32 | 47 |
/// Set the name of this client. |
sl@32 | 48 |
/// Name is a convenient way to recognize your client. |
sl@32 | 49 |
/// Naming you client is not mandatory. |
sl@32 | 50 |
/// In the absence of a name the session ID is often used instead. |
sl@32 | 51 |
/// </summary> |
sl@32 | 52 |
/// <param name="aClientName"></param> |
sl@24 | 53 |
[OperationContract(IsOneWay = true)] |
sl@32 | 54 |
void SetName(string aClientName); |
sl@24 | 55 |
|
sl@32 | 56 |
/// <summary> |
sl@32 | 57 |
/// Put the given text in the given field on your display. |
sl@32 | 58 |
/// Fields are often just lines of text. |
sl@32 | 59 |
/// </summary> |
sl@43 | 60 |
/// <param name="aTextFieldIndex"></param> |
sl@24 | 61 |
[OperationContract(IsOneWay = true)] |
sl@43 | 62 |
void SetText(TextField aTextField); |
sl@26 | 63 |
|
sl@32 | 64 |
/// <summary> |
sl@32 | 65 |
/// Allows a client to set multiple text fields at once. |
sl@32 | 66 |
/// </summary> |
sl@32 | 67 |
/// <param name="aTexts"></param> |
sl@24 | 68 |
[OperationContract(IsOneWay = true)] |
sl@43 | 69 |
void SetTexts(System.Collections.Generic.IList<TextField> aTextFields); |
sl@32 | 70 |
|
sl@32 | 71 |
/// <summary> |
sl@32 | 72 |
/// Provides the number of clients currently connected |
sl@32 | 73 |
/// </summary> |
sl@32 | 74 |
/// <returns></returns> |
sl@32 | 75 |
[OperationContract()] |
sl@32 | 76 |
int ClientCount(); |
sl@32 | 77 |
|
sl@24 | 78 |
} |
sl@24 | 79 |
|
sl@24 | 80 |
|
sl@24 | 81 |
public interface IDisplayServiceCallback |
sl@24 | 82 |
{ |
sl@24 | 83 |
[OperationContract(IsOneWay = true)] |
sl@24 | 84 |
void OnConnected(); |
sl@24 | 85 |
|
sl@32 | 86 |
/// <summary> |
sl@32 | 87 |
/// Tell our client to close its connection. |
sl@32 | 88 |
/// Notably sent when the server is shutting down. |
sl@32 | 89 |
/// </summary> |
sl@24 | 90 |
[OperationContract(IsOneWay = true)] |
sl@32 | 91 |
void OnCloseOrder(); |
sl@24 | 92 |
} |
sl@24 | 93 |
|
sl@24 | 94 |
|
sl@24 | 95 |
|
sl@24 | 96 |
} |