Client/MainForm.cs
author sl
Tue, 12 Aug 2014 20:55:50 +0200
changeset 18 7acec5059fa6
child 19 1a85ec255882
permissions -rw-r--r--
Adding our client implementation. Moving server into its own folder.
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@18
    28
            iClient.SetText(0,"Top");
sl@18
    29
            iClient.SetText(1, "Bottom");
sl@18
    30
        }
sl@18
    31
sl@18
    32
        private void MainForm_Load(object sender, EventArgs e)
sl@18
    33
        {
sl@18
    34
sl@18
    35
            iChannelFactory = new ChannelFactory<SharpDisplayManager.IDisplayService>(
sl@18
    36
                new NetNamedPipeBinding(),
sl@18
    37
                new EndpointAddress(
sl@18
    38
                "net.pipe://localhost/DisplayService"));
sl@18
    39
sl@18
    40
            iClient = iChannelFactory.CreateChannel();
sl@18
    41
        }
sl@18
    42
    }
sl@18
    43
}