private string RemoteAddress = Properties.Settings.Default.server_ip; // Define Network Propertys (ServerIP and commandport) #endregion Fields #region Constructors public SynChat() { InitializeComponent(); // Clear all indices in chat marker array for(int i=0; i < 10; i++) { freechats[i] = true; chatbuddies[i] = ""; } // Marrie the delegates with their events (needed for invokes) OnReceiveBuddy += new Buddy(ReceiveBuddy); EnableItems += new Enable(Enable_Items); OnReceive += new Receive(OpenChat); OnStatusChange += new BuddyStatus(StatusChange); OnStatusReceived += new RequestedStatusReceived(RequestedStatusReceive); OnStatusSend += new StatusSend(SendStatus); Client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // Create the Socket try { // Try to connect and send the port request command Client.Connect(IPAddress.Parse(RemoteAddress), port); } catch (SocketException) { // If that fails -> Show a error and close the Application MessageBox.Show("Konnte keine Verbindung zum Server herstellen!"); debugFile.Write("Server unavaliable\r\n"); this.Close(); } // Create the Thread for the Listener and put it in the background Thread lis = new Thread(new ThreadStart(Listener)); lis.IsBackground = true; lis.Start(); // Remove menu entry for clearing chatlogs if chatlogs are disabled if (Properties.Settings.Default.client_log_conversations) { alleMitschnitteLöschenToolStripMenuItem.Visible = true; } }
public UserStatusEventArgs(string username, BuddyStatus status) { this.username = username; this.status = status; }
private void UpdateBuddyStatus(string name, BuddyStatus status) { BuddyInfo budd = _buddyList.GetBuddy(name); budd.Status = status; }
public void SendStatus(string user, BuddyStatus status) { sw.WriteLine("STATUS {0} {1}", user, status.ToString().ToUpper()); sw.Flush(); }