private void ButtonLogIn_Click(object sender, EventArgs e) { if (!ValidInput() || ServerCommunicator.Communicating) { return; } ServerCommunicator.Communicating = true; ServerCommunicator.Login(textBoxUserName.Text, textBoxPassWord.Text); }
private void TextBoxSend_KeyDown(object o, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; if (!string.IsNullOrEmpty(currentSendTextBox.Text.Trim())) { TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); string timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss" + ((utcOffset < TimeSpan.Zero) ? "-" : "+") + utcOffset.Hours.ToString("00") + ":" + utcOffset.Minutes.ToString("00")); int msgId = PendingMessages.AppendPendingMessage(Username, tabControlConversations.SelectedTab.Text, timestamp, currentSendTextBox.Text); currentReadTextBox.AppendText(currentSendTextBox.Text + "\n"); currentSendTextBox.Clear(); currentSendTextBox.Select(0, 0); ServerCommunicator.SendMessage(Username, tabControlConversations.SelectedTab.Text, timestamp, currentSendTextBox.Text, msgId.ToString()); } } }