Beispiel #1
0
 private void Chat_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         Chat.Clear();
     }
 }
Beispiel #2
0
        /*
         * Method :		SendCrypt_Click()
         * Description:    When the Connection Button Clickedit sent the message with encrepted.
         * Return value:	No
         */

        private void SendCrypt_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check the connection status. If the server is connected
                // Read the text form textbox and send it to the server
                if (connect)
                {
                    if (Chat.Text != "")
                    {
                        StreamWriter output      = new StreamWriter(clientList[0]);
                        StreamWriter cryptOutput = new StreamWriter(clientList[0]);
                        string       x           = Chat.Text;
                        History.Items.Add("[ " + DateTime.Now.ToString("HH:mm") + " ] You:  " + Chat.Text);
                        History.ScrollIntoView(History.Items[History.Items.Count - 1]);

                        string outp = Chat.Text;
                        output.WriteLine(outp);
                        output.Flush();
                        //Applying the BlowFish encryption to the message
                        string encrypted = blowFish.Encrypt_CBC(outp);

                        cryptOutput.WriteLine(encrypted);
                        //output.WriteLine(outp);
                        cryptOutput.Flush();
                        Chat.Clear();
                    }
                    else
                    {
                        Error.Content = ">>!!!Message can not be blank!!!<<";
                    }
                }
                // Otherwiser notify the user Sever is not connected
                else
                {
                    Error.Content = ">>!!!You are not connected to the Server!!!<<";
                }
            }
            catch (Exception ex)
            {
                Error.Content = ex;
            }
        }
Beispiel #3
0
 private void clearHistoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Chat.Clear();
     Log.Clear();
 }