diff -r fe4c711fd7f8 -r 0cb7b9f6a6f8 GUI/SharpDisplayClient.cs --- a/GUI/SharpDisplayClient.cs Sun Sep 21 21:55:36 2014 +0200 +++ b/GUI/SharpDisplayClient.cs Mon Sep 22 21:59:11 2014 +0200 @@ -26,11 +26,75 @@ namespace SharpDisplay { - //That contract need to be in the same namespace than the original assembly - //otherwise our parameter won't make to the server. - //See: http://stackoverflow.com/questions/14956377/passing-an-object-using-datacontract-in-wcf/25455292#25455292 + + + + /// + /// For client to specify a specific layout. + /// [DataContract] - public class TextField + public class TableLayout + { + public TableLayout() + { + Columns = new List(); + Rows = new List(); + Cells = new List(); + } + + public TableLayout(int aColumnCount, int aRowCount) + { + Columns = new List(); + Rows = new List(); + + for (int i = 0; i < aColumnCount; i++) + { + Columns.Add(new ColumnStyle(SizeType.Percent, 100 / aColumnCount)); + } + + for (int i = 0; i < aRowCount; i++) + { + Rows.Add(new RowStyle(SizeType.Percent, 100 / aRowCount)); + } + } + + [DataMember] + public List Cells { get; set; } + + [DataMember] + public List Columns { get; set; } + + [DataMember] + public List Rows { get; set; } + + } + + /// + /// + /// + [DataContract] + public class DataField + { + [DataMember] + public int Column { get; set; } + + [DataMember] + public int Row { get; set; } + + [DataMember] + public int ColumnSpan { get; set; } + + [DataMember] + public int RowSpan { get; set; } + + } + + + /// + /// TextField can be send to our server to be displayed on the screen. + /// + [DataContract] + public class TextField : DataField { public TextField() { @@ -56,7 +120,12 @@ public ContentAlignment Alignment { get; set; } } - + /// + /// Define our SharpDisplay service. + /// Clients and servers must implement it to communicate with one another. + /// Through this service clients can send requests to a server. + /// Through this service a server session can receive requests from a client. + /// [ServiceContract(CallbackContract = typeof(ICallback), SessionMode = SessionMode.Required)] public interface IService { @@ -70,6 +139,13 @@ [OperationContract(IsOneWay = true)] void SetName(string aClientName); + + /// + /// + /// + [OperationContract(IsOneWay = true)] + void SetLayout(TableLayout aLayout); + /// /// Put the given text in the given field on your display. /// Fields are often just lines of text. @@ -94,7 +170,9 @@ } - + /// + /// SharDisplay callback provides a means for a server to notify its clients. + /// public interface ICallback { [OperationContract(IsOneWay = true)] @@ -107,6 +185,9 @@ [OperationContract(IsOneWay = true)] void OnCloseOrder(); } + + + } @@ -133,6 +214,11 @@ Channel.SetName(aClientName); } + public void SetLayout(TableLayout aLayout) + { + Channel.SetLayout(aLayout); + } + public void SetText(TextField aTextField) { Channel.SetText(aTextField);