/// <summary> /// Handles the Click event of the OK button on a second window. /// Sends entered data to the server and receiving a response, displays it in the window. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void SecondOk_Click(object sender, EventArgs e) { string[] xValues = new string[Convert.ToInt32(Number_vars.Value)]; string[] yValues = new string[Convert.ToInt32(Number_vars.Value)]; for (int i = 0; i < xValues.Length; i++) { TextBox TxtBox = Controls["X" + i.ToString()] as TextBox; xValues[i] = TxtBox.Text; TxtBox = Controls["Y" + i.ToString()] as TextBox; yValues[i] = TxtBox.Text; } string message = String.Join(",", xValues) + "|" + String.Join(",", yValues); string name = WindowsIdentity.GetCurrent().Name; ClientObject clientObject = new ClientObject(IPAddress.Loopback, 8001); clientObject.Send(message); clientObject.Send(name); string answer = clientObject.Recieve(); clientObject.Close(); Controls.Clear(); this.Width = 500; this.Height = 160; char[] chars = { '=', '>' }; string[] pair = answer.Split(chars, StringSplitOptions.RemoveEmptyEntries); AddLabel(64, new Point(15, 10), "Label_Conclusion", "Вывод:"); AddLabel(350, new Point(15, 50), "Coefficient", "Коэффициент Спирмена: " + pair[0]); AddLabel(425, new Point(15, 80), "Conclusion", pair[1].Trim()); }