Client/MainForm.cs
changeset 77 042c1fa136b9
parent 75 2549a8055bd1
parent 74 60d584bad780
child 78 f0dda362f77e
     1.1 --- a/Client/MainForm.cs	Tue Dec 16 10:59:10 2014 +0100
     1.2 +++ b/Client/MainForm.cs	Tue Dec 16 11:08:18 2014 +0100
     1.3 @@ -17,8 +17,8 @@
     1.4  {
     1.5      public partial class MainForm : Form
     1.6      {
     1.7 -        Client iClient;
     1.8 -        Callback iCallback;
     1.9 +        DisplayClient iClient;
    1.10 +
    1.11          ContentAlignment Alignment;
    1.12          DataField iTextFieldTop;
    1.13  
    1.14 @@ -32,8 +32,8 @@
    1.15  
    1.16          private void MainForm_Load(object sender, EventArgs e)
    1.17          {
    1.18 -            iCallback = new Callback(this);
    1.19 -            iClient = new Client(iCallback);
    1.20 +            iClient = new DisplayClient(this);
    1.21 +            iClient.Open();
    1.22  
    1.23              //Connect using unique name
    1.24              //string name = DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");
    1.25 @@ -69,13 +69,13 @@
    1.26                  //We are in the proper thread
    1.27                  if (IsClientReady())
    1.28                  {
    1.29 -                    Trace.TraceInformation("Closing client: " + iClient.SessionId);
    1.30 +                    string sessionId = iClient.SessionId;
    1.31 +                    Trace.TraceInformation("Closing client: " + sessionId);
    1.32                      iClient.Close();
    1.33 -                    Trace.TraceInformation("Closed client: " + iClient.SessionId);
    1.34 +                    Trace.TraceInformation("Closed client: " + sessionId);
    1.35                  }
    1.36  
    1.37                  iClient = null;
    1.38 -                iCallback = null;
    1.39              }
    1.40          }
    1.41  
    1.42 @@ -105,7 +105,7 @@
    1.43  
    1.44          public bool IsClientReady()
    1.45          {
    1.46 -            return (iClient != null && iClient.State == CommunicationState.Opened);
    1.47 +            return (iClient != null && iClient.IsReady());
    1.48          }
    1.49  
    1.50          private void buttonAlignLeft_Click(object sender, EventArgs e)
    1.51 @@ -196,7 +196,7 @@
    1.52              TableLayout layout = new TableLayout(2, 2);
    1.53              //First column only takes 25%
    1.54              layout.Columns[0].Width = 25F;
    1.55 -            //Second column takes up 75% 
    1.56 +            //Second column takes up 75%
    1.57              layout.Columns[1].Width = 75F;
    1.58              //Send layout to server
    1.59              iClient.SetLayout(layout);
    1.60 @@ -221,6 +221,7 @@
    1.61              DataField field = new DataField(0, bitmap);
    1.62              //We want our bitmap field to span across two rows
    1.63              field.RowSpan = 2;
    1.64 +            iClient.SetField(field);
    1.65  
    1.66              //Set texts
    1.67              iClient.SetFields(new DataField[]