Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using WindowsFormsServiceClient.ServiceReference;
- using Contracts;
- namespace WindowsFormsServiceClient
- {
- public partial class Form1 : Form
- {
- ServiceConsumer sc = null;
- public Form1()
- {
- try
- {
- ServiceCommunicationConfigorator sc = new ServiceCommunicationConfigorator();
- InitializeComponent();
- if (sc.getEndPointNames().Count > 0)
- {
- this.comboBox1.DataSource = sc.getEndPointNames();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
- private ServiceConsumer connect()
- {
- ServiceConsumer sc = new ServiceConsumer(this.comboBox1.SelectedItem.ToString());
- sc.setConnection(null);
- return sc;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.textBox1.Enabled = false;
- if (this.sc == null)
- {
- this.sc = connect();
- }
- else
- {
- if (this.sc.getClient().State.Equals(System.ServiceModel.CommunicationState.Faulted))
- {
- this.sc = connect();
- }
- }
- try
- {
- int limit = Convert.ToInt32(this.textBox1.Text.ToString());
- StringBuilder sb = new StringBuilder();
- Box<Person> container = null;
- for (; limit > 0; limit-=100)
- {
- if (this.checkBox1.Checked)
- {
- container = sc.listOfPersons(limit, true);
- }
- else
- {
- container = sc.listOfPersons(limit, false);
- }
- if (container != null)
- {
- sb.Append("Element: " + limit + " Time: " + container.time + "\r\n");
- }
- }
- this.textBox2.Text = sb.ToString();
- // List<Person> com = sc.getKommunikationForPerson(container.payload.ToList<Person>());
- //this.label3.Text = this.label3.Text + "Length: " + container.payload.Length + " Limit:" + this.textBox1.Text + " Time: " + container.time +" Lists:" + ServiceConsumer.timeInMillis + "\r\n";
- this.textBox1.Enabled = true;
- }
- catch (Exception ex)
- {
- this.textBox1.Enabled = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement