Ejemplo n.º 1
0
        /// <summary>
        /// Launch a virtual ring
        /// </summary>
        /// <param name="sender"/>
        /// <param name="e"/>
        private void VirtualLaunchButton_Click(object sender, EventArgs e)
        {
            Logger.Logging = false;
            int numClients = int.Parse(VirtualItemsSelect.Text);
            int lineQuality = (int) NoisePotential.Value;
            Logger.Log("Setting up virtual ring {0} long".With(numClients));
            List<ClientUI> clients = new List<ClientUI>();
            for (int i = 1; i <= numClients; i++) {
                InMemoryInput comms = new InMemoryInput {quality = lineQuality};
                ClientUI client = new ClientUI(comms);
                client.FormClosed += client_FormClosed;
                openForms++;
                clients.Add(client);
            }
            ((InMemoryInput) clients.Last().Client.Communications).Partner = ((InMemoryInput) clients.First().Client.Communications);
            for (int i = 0;  i < clients.Count - 1; i++) {
                ClientUI client = clients[i];
                ClientUI nextClient = clients[i + 1];
                ((InMemoryInput) client.Client.Communications).Partner = ((InMemoryInput) nextClient.Client.Communications);
            }

            clients.ForEach(client => client.Show());
            this.Hide();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// A constructor to set up the object with a transmission partner
 /// </summary>
 /// <param name="partner"></param>
 public InMemoryInput(InMemoryInput partner)
 {
     _partner = partner;
 }