Interface/Interface.cs
changeset 43 86aad774b532
parent 32 4c416d2878dd
child 55 b5ed2e29be23
     1.1 --- a/Interface/Interface.cs	Fri Aug 22 10:55:34 2014 +0200
     1.2 +++ b/Interface/Interface.cs	Fri Aug 22 22:48:30 2014 +0200
     1.3 @@ -5,11 +5,40 @@
     1.4  using System.Threading.Tasks;
     1.5  using System.ServiceModel;
     1.6  using System.Collections;
     1.7 +using System.Drawing;
     1.8 +using System.Runtime.Serialization;
     1.9  
    1.10  
    1.11  namespace SharpDisplayInterface
    1.12  {
    1.13 -    
    1.14 +    [DataContract]
    1.15 +    public class TextField
    1.16 +    {
    1.17 +        public TextField()
    1.18 +        {
    1.19 +            Index = 0;
    1.20 +            Text = "";
    1.21 +            Alignment = ContentAlignment.MiddleLeft;
    1.22 +        }
    1.23 +
    1.24 +        public TextField(int aIndex, string aText = "", ContentAlignment aAlignment = ContentAlignment.MiddleLeft)
    1.25 +        {
    1.26 +            Index = aIndex;
    1.27 +            Text = aText;
    1.28 +            Alignment = aAlignment;
    1.29 +        }
    1.30 +
    1.31 +        [DataMember]
    1.32 +        public int Index { get; set; }
    1.33 +
    1.34 +        [DataMember]
    1.35 +        public string Text { get; set; }
    1.36 +
    1.37 +        [DataMember]
    1.38 +        public ContentAlignment Alignment { get; set; }
    1.39 +    }
    1.40 +
    1.41 +
    1.42      [ServiceContract(   CallbackContract = typeof(IDisplayServiceCallback),
    1.43                          SessionMode = SessionMode.Required)]
    1.44      public interface IDisplayService
    1.45 @@ -28,19 +57,16 @@
    1.46          /// Put the given text in the given field on your display.
    1.47          /// Fields are often just lines of text.
    1.48          /// </summary>
    1.49 -        /// <param name="aFieldIndex"></param>
    1.50 -        /// <param name="aText"></param>
    1.51 +        /// <param name="aTextFieldIndex"></param>
    1.52          [OperationContract(IsOneWay = true)]
    1.53 -        void SetText(int aFieldIndex, string aText);
    1.54 +        void SetText(TextField aTextField);
    1.55  
    1.56          /// <summary>
    1.57          /// Allows a client to set multiple text fields at once.
    1.58 -        /// First text in the list is set into field index 0.
    1.59 -        /// Last text in the list is set into field index N-1.
    1.60          /// </summary>
    1.61          /// <param name="aTexts"></param>
    1.62          [OperationContract(IsOneWay = true)]
    1.63 -        void SetTexts(System.Collections.Generic.IList<string> aTexts);
    1.64 +        void SetTexts(System.Collections.Generic.IList<TextField> aTextFields);
    1.65  
    1.66          /// <summary>
    1.67          /// Provides the number of clients currently connected