Example #1
0
        /// <summary>
        /// Metoda wysyłająca wiadomość użytkownika
        /// </summary>
        private void TextToSendMethod()
        {
            if (!areCharsOver)
            {
                string msg = MsgTextBox.Text;

                byte[] encryptedMsg = CryptoModule.EncryptMsg(Encoding.UTF8.GetBytes(msg), loginToConnect);
                byte[] signedMsg    = CryptoModule.Sign(msg);
                byte[] toSend       = new byte[259];
                byte[] prefix       = Encoding.UTF8.GetBytes("MSG");

                Array.Copy(prefix, 0, toSend, 0, 3);
                Array.Copy(encryptedMsg, 0, toSend, 3, 128);
                Array.Copy(signedMsg, 0, toSend, 131, 128);

                cm.Send(toSend);

                WriteInLogAsThisUser(msg);
                MsgTextBox.ResetText();
            }
        }
        private void IDComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //ComboBoxItem typeItem = (ComboBoxItem)IDComboBox.SelectedItem;
            //string selection = typeItem.Content.ToString();
            if (IDComboBox.Items.Count != 0)
            {
                string selection = IDComboBox.SelectedItem.ToString();

                foreach (var message in MainWindow.messagesJSON.messages)
                {
                    if (message.ID == selection)
                    {
                        MsgTextBox.Clear();
                        MsgTextBox.AppendText("Sender: " + message.sender + "\n");
                        if (message.subject != "")
                        {
                            MsgTextBox.AppendText("Subject: " + message.subject + "\n");
                        }
                        MsgTextBox.AppendText("\nMessage: " + message.message + "\n");
                    }
                }
            }
        }
 private void MsgTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     MsgTextBox.ScrollToEnd();
 }
Example #4
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     //MsgTextBox.Text = tester.Msg;*/
     MsgTextBox.Clear();
 }
 private void SendBtn_Click(object sender, RoutedEventArgs e)
 {
     MsgTextBox.Clear();
 }