sl@24: using System; sl@24: using System.Collections.Generic; sl@24: using System.Linq; sl@24: using System.Text; sl@24: using System.Threading.Tasks; sl@24: using System.ServiceModel; sl@24: using System.Collections; sl@43: using System.Drawing; sl@43: using System.Runtime.Serialization; sl@24: sl@24: sl@24: namespace SharpDisplayInterface sl@24: { sl@43: [DataContract] sl@43: public class TextField sl@43: { sl@43: public TextField() sl@43: { sl@43: Index = 0; sl@43: Text = ""; sl@43: Alignment = ContentAlignment.MiddleLeft; sl@43: } sl@43: sl@43: public TextField(int aIndex, string aText = "", ContentAlignment aAlignment = ContentAlignment.MiddleLeft) sl@43: { sl@43: Index = aIndex; sl@43: Text = aText; sl@43: Alignment = aAlignment; sl@43: } sl@43: sl@43: [DataMember] sl@43: public int Index { get; set; } sl@43: sl@43: [DataMember] sl@43: public string Text { get; set; } sl@43: sl@43: [DataMember] sl@43: public ContentAlignment Alignment { get; set; } sl@43: } sl@43: sl@43: sl@30: [ServiceContract( CallbackContract = typeof(IDisplayServiceCallback), sl@30: SessionMode = SessionMode.Required)] sl@24: public interface IDisplayService sl@24: { sl@32: /// sl@32: /// Set the name of this client. sl@32: /// Name is a convenient way to recognize your client. sl@32: /// Naming you client is not mandatory. sl@32: /// In the absence of a name the session ID is often used instead. sl@32: /// sl@32: /// sl@24: [OperationContract(IsOneWay = true)] sl@32: void SetName(string aClientName); sl@24: sl@32: /// sl@32: /// Put the given text in the given field on your display. sl@32: /// Fields are often just lines of text. sl@32: /// sl@43: /// sl@24: [OperationContract(IsOneWay = true)] sl@43: void SetText(TextField aTextField); sl@26: sl@32: /// sl@32: /// Allows a client to set multiple text fields at once. sl@32: /// sl@32: /// sl@24: [OperationContract(IsOneWay = true)] sl@43: void SetTexts(System.Collections.Generic.IList aTextFields); sl@32: sl@32: /// sl@32: /// Provides the number of clients currently connected sl@32: /// sl@32: /// sl@32: [OperationContract()] sl@32: int ClientCount(); sl@32: sl@24: } sl@24: sl@24: sl@24: public interface IDisplayServiceCallback sl@24: { sl@24: [OperationContract(IsOneWay = true)] sl@24: void OnConnected(); sl@24: sl@32: /// sl@32: /// Tell our client to close its connection. sl@32: /// Notably sent when the server is shutting down. sl@32: /// sl@24: [OperationContract(IsOneWay = true)] sl@32: void OnCloseOrder(); sl@24: } sl@24: sl@24: sl@24: sl@24: }