using System; using System.Collections.Generic; using System.Windows.Forms; using DistributedGA.Core; using DistributedGA.Core.Domain; using DistributedGA.Core.Implementation; using DistributedGA.Core.Interface; namespace DistributedGA.Test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { IMessageService s = new WcfMessageService(); s.Init(""); } private void button2_Click(object sender, EventArgs e) { IMessageSender c = new WcfMessageSender(); c.Init(null); c.SendData(null, null); } private void button3_Click(object sender, EventArgs e) { IMessageHandler h1 = new PeerNetworkMessageHandler(); h1.Init("", ""); IMessageHandler h2 = new PeerNetworkMessageHandler(); h2.Init("", ""); IMessageHandler h3 = new PeerNetworkMessageHandler(); h3.Init("", ""); IMessageHandler h4 = new PeerNetworkMessageHandler(); h4.Init("", ""); IMessageHandler h5 = new PeerNetworkMessageHandler(); h5.Init("", ""); //byte[] message = CreateTestMessage(); //h1.PublishDataToNetwork(pop1); //h1.PublishDataToNetwork(pop1); //var res1 = h1.GetDataFromNetwork(); //var res2 = h2.GetDataFromNetwork(); //h1.PublishDataToNetwork(pop1); //h1.PublishDataToNetwork(pop1); //var res3 = h1.GetDataFromNetwork(); //var res4 = h2.GetDataFromNetwork(); //h1.PublishDataToNetwork(pop1); //h1.PublishDataToNetwork(pop1); var res5 = h1.GetDataFromNetwork(); var res6 = h2.GetDataFromNetwork(); int i = 0; } private void button4_Click(object sender, EventArgs e) { var l = new WcfPeerListManager(); l.Init(CreatePeerInfo(),""); l.GetPeerList(); } private void button5_Click(object sender, EventArgs e) { Dictionary d1 = new Dictionary(); d1.Add("test", 5); if (d1.ContainsKey("test")) { int i = 0; } else { int j = 0; } Dictionary d2 = new Dictionary(); PeerInfo p1 = CreatePeerInfo(); PeerInfo p2 = CreatePeerInfo(); d2.Add(p1, 5); if (d2.ContainsKey(p1)) { int i = 0; } if (d2.ContainsKey(p2)) { int i = 0; } } private PeerInfo CreatePeerInfo() { return new PeerInfo() { IpAddress = "192.168.0.4", Port = 3030 }; } } }