Simplifying client construction.
Fixing our borders and sorting out our color issues.
Adding inverse colors options.
2 // Define a public API for both SharpDisplay client and server to use.
6 using System.Collections.Generic;
9 using System.Threading.Tasks;
10 using System.ServiceModel;
11 using System.Collections;
13 using System.Runtime.Serialization;
16 namespace SharpDisplay
19 /// TextField can be send to our server to be displayed on the screen.
22 public class TextField
28 Alignment = ContentAlignment.MiddleLeft;
31 public TextField(int aIndex, string aText = "", ContentAlignment aAlignment = ContentAlignment.MiddleLeft)
35 Alignment = aAlignment;
39 public int Index { get; set; }
42 public string Text { get; set; }
45 public ContentAlignment Alignment { get; set; }
49 /// Define our SharpDisplay service.
50 /// Clients and servers must implement it to communicate with one another.
51 /// Through this service clients can send requests to a server.
52 /// Through this service a server session can receive requests from a client.
54 [ServiceContract( CallbackContract = typeof(ICallback), SessionMode = SessionMode.Required)]
55 public interface IService
58 /// Set the name of this client.
59 /// Name is a convenient way to recognize your client.
60 /// Naming you client is not mandatory.
61 /// In the absence of a name the session ID is often used instead.
63 /// <param name="aClientName"></param>
64 [OperationContract(IsOneWay = true)]
65 void SetName(string aClientName);
68 /// Put the given text in the given field on your display.
69 /// Fields are often just lines of text.
71 /// <param name="aTextFieldIndex"></param>
72 [OperationContract(IsOneWay = true)]
73 void SetText(TextField aTextField);
76 /// Allows a client to set multiple text fields at once.
78 /// <param name="aTexts"></param>
79 [OperationContract(IsOneWay = true)]
80 void SetTexts(System.Collections.Generic.IList<TextField> aTextFields);
83 /// Provides the number of clients currently connected
85 /// <returns></returns>
92 /// SharDisplay callback provides a means for a server to notify its clients.
94 public interface ICallback
96 [OperationContract(IsOneWay = true)]
100 /// Tell our client to close its connection.
101 /// Notably sent when the server is shutting down.
103 [OperationContract(IsOneWay = true)]