Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            for (int i = 0; i < m_client.Length; i++)
            {
                m_client[i]     = new ChatWCFClient(ipAddress, this);
                m_serverGuid[i] = Guid.NewGuid();
            }
        }
Ejemplo n.º 2
0
        private async void button7_Click(object sender, EventArgs e)
        {
            string msg = textBox4.Text;
            await Task.Run(() =>
            {
                if (m_client[3].Broadcast(msg, out string outMessage) == false)
                {
                    m_client[3] = new ChatWCFClient(ipAddress, this);
                    m_client[3].Connect(txtUserName.Text, "freedesc", m_serverGuid[3], DateTime.Now, out outMessage);
                    m_client[3].Broadcast(msg, out outMessage);
                }
            });

            timer1.Enabled = true;
        }
Ejemplo n.º 3
0
 private async void btnConnect_Click(object sender, EventArgs e)
 {
     await Task.Run(() =>
     {
         try
         {
             if (m_client[0].Connect(txtUserName.Text, "freedesc", m_serverGuid[0], DateTime.Now, out string outMessage) == false)
             {
                 m_client[0] = new ChatWCFClient(ipAddress, this);
                 m_client[0].Connect(txtUserName.Text, "freedesc", m_serverGuid[0], DateTime.Now, out outMessage);
             }
         }
         catch (Exception err)
         {
             Console.WriteLine("Failed to connect: " + err.Message);
         }
     });
 }