Client/MainForm.cs
author sl
Tue, 12 Aug 2014 21:27:35 +0200
changeset 19 1a85ec255882
parent 18 7acec5059fa6
child 20 e3d394dd0388
permissions -rw-r--r--
Adding server method to set all texts at once.
sl@18
     1
using System;
sl@18
     2
using System.Collections.Generic;
sl@18
     3
using System.ComponentModel;
sl@18
     4
using System.Data;
sl@18
     5
using System.Drawing;
sl@18
     6
using System.Linq;
sl@18
     7
using System.Text;
sl@18
     8
using System.Threading.Tasks;
sl@18
     9
using System.Windows.Forms;
sl@18
    10
using System.ServiceModel;
sl@18
    11
using System.ServiceModel.Channels;
sl@18
    12
using SharpDisplayManager;
sl@18
    13
sl@18
    14
namespace SharpDisplayClient
sl@18
    15
{
sl@18
    16
    public partial class MainForm : Form
sl@18
    17
    {
sl@18
    18
        ChannelFactory<SharpDisplayManager.IDisplayService> iChannelFactory;
sl@18
    19
        SharpDisplayManager.IDisplayService iClient;
sl@18
    20
sl@18
    21
        public MainForm()
sl@18
    22
        {
sl@18
    23
            InitializeComponent();
sl@18
    24
        }
sl@18
    25
sl@18
    26
        private void buttonSetText_Click(object sender, EventArgs e)
sl@18
    27
        {
sl@19
    28
            //iClient.SetText(0,"Top");
sl@19
    29
            //iClient.SetText(1, "Bottom");
sl@19
    30
            iClient.SetTexts(new string[] { "Top", "Bottom" });
sl@18
    31
        }
sl@18
    32
sl@18
    33
        private void MainForm_Load(object sender, EventArgs e)
sl@18
    34
        {
sl@18
    35
sl@18
    36
            iChannelFactory = new ChannelFactory<SharpDisplayManager.IDisplayService>(
sl@18
    37
                new NetNamedPipeBinding(),
sl@18
    38
                new EndpointAddress(
sl@18
    39
                "net.pipe://localhost/DisplayService"));
sl@18
    40
sl@18
    41
            iClient = iChannelFactory.CreateChannel();
sl@18
    42
        }
sl@18
    43
    }
sl@18
    44
}