|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ConferenceLibrary;
namespace ConferenceClient
{
public partial class Form1 : Form
{
TextChatClient ChatClient;
VoiceChatClient VoiceClient;
public Form1()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
try
{
ChatClient = new TextChatClient("127.0.0.1", 4500, "irfan");
}
catch
{
MessageBox.Show("Conference server is not running.");
}
ChatClient.MessageRecieved += new TextChatClient.MessageEventHandler(ChatClient_MessageRecieved);
ChatClient.UserAdded += new TextChatClient.UserAddedEventHandler(ChatClient_UserAdded);
ChatClient.UserRemoved += new TextChatClient.UserRemovedEventHandler(ChatClient_UserRemoved);
}
void ChatClient_UserRemoved(object sender, UserArgs e)
{
cbxUsers.Items.Remove(e.UserName);
}
void ChatClient_UserAdded(object sender, UserArgs e)
{
cbxUsers.Items.Add(e.UserName);
}
void ChatClient_MessageRecieved(object sender,MessageArgs e)
{
txtRecievedMessages.Text += e.Message;
}
private void btnSend_Click(object sender, EventArgs e)
{
ChatClient.sendMessage(txtMessage.Text,cbxUsers.Text);
txtMessage.Text = "" ;
}
private void btnMute_Click(object sender, EventArgs e)
{
}
private void btnConnect_Click(object sender, EventArgs e)
{
if (btnConnect.Text.Equals("Connect"))
{
if (!String.IsNullOrEmpty(txtServerIP.Text))
{
if (VoiceClient == null)
{
VoiceClient = new VoiceChatClient(txtServerIP.Text, "Server", 4501, 4502);
VoiceClient.InitializeCall(this);
btnConnect.Text = "Disconnect";
}
}
else
{
MessageBox.Show("Enter Server IP.");
}
}
else
{
if (VoiceClient != null)
{
VoiceClient.UninitializeCall();
VoiceClient = null;
btnConnect.Text = "Connect";
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
He is a Software Engineer working in Technology Promotion International.He has completed his BS(Software Engineering) from University of Karachi,Pakistan.he has scored 1st Position in the batch of 2008 in department of Computer Science and scored 2nd Position in faculty of Science.
He has been working in Technology Promotion International since June 2008. Here,he has worked on many Projects and learned many different technologies like WPF, Silverlight, LINQ and many more.His major expertise are in C#,ASP.NET,Crystal Report,SQL Server.