Beispiel #1
0
        private void ListViewItem_1_Selected(object sender, RoutedEventArgs e)
        {
            messagePlace.Children.Clear();
            object       obj      = e.Source;
            ListViewItem viewItem = (ListViewItem)obj;
            TextBlock    block    = (TextBlock)viewItem.FindName("userName");
            Border       border   = (Border)viewItem.FindName("messageBorderCount");

            border.Visibility = Visibility.Collapsed;
            selectedId        = viewItem.Name.Replace("id", "");
            chatName.Text     = chatTitle.Text = block.Text;
            selectedStatus    = (bool)viewItem.Tag;

            if ((bool)viewItem.Tag)
            {
                OpenCorrespondence openCorrespondence = new OpenCorrespondence("group", Convert.ToInt32(selectedId));
                ConnectToServer.SendRequest(openCorrespondence);
            }
            //ConnectToServer.SendRequest($"group {selectedId}");
            else
            {
                OpenCorrespondence openCorrespondence = new OpenCorrespondence("chat", Convert.ToInt32(selectedId));
                ConnectToServer.SendRequest(openCorrespondence);
            }
            //ConnectToServer.SendRequest($"chat {selectedId}");

            MessPanel.Visibility = Visibility.Visible;
        }
Beispiel #2
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            UserControlMessageReceived userControlMessageReceived = new UserControlMessageReceived();
            MessageEvent @event = new MessageEvent("Delete", "chat", selectedId, DateTime.Now, 3030, "");

            ConnectToServer.SendRequest(@event);
        }
        private void messageTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (messageTextBox.Text == "")
                {
                    e.Handled = true;
                }
                else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
                {
                    this.messageTextBox.Text      += "\n";
                    this.messageTextBox.CaretIndex = this.messageTextBox.Text.Length;
                    e.Handled = true;
                }
                else if (messageTextBox.Text != "")
                {
                    e.Handled        = true;
                    messageText.Text = messageTextBox.Text;

                    MessageEvent @event = new MessageEvent("Update", "chat", ChatWindow.selectedId, System.DateTime.Now, Id, "");
                    ConnectToServer.SendRequest(@event);

                    TextBoxGrid.Visibility = Visibility.Collapsed;
                }
            }
        }
Beispiel #4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     ConnectToServer.createStream();
     ConnectToServer.loginToServer    = loginBox.Text;
     ConnectToServer.passwordToServer = passwordBox.Password.ToString();
     ConnectToServer.SendRequest();
 }
        private void MenuItem_Click_2(object sender, RoutedEventArgs e)
        {
            MessageEvent @event = new MessageEvent("Delete", "chat", ChatWindow.selectedId, System.DateTime.Now, Id, "");

            ConnectToServer.SendRequest(@event);

            OpenCorrespondence openCorrespondence = new OpenCorrespondence("chat", System.Convert.ToInt32(ChatWindow.selectedId));

            ConnectToServer.SendRequest(openCorrespondence);
        }
Beispiel #6
0
        private void SentButton_Click(object sender, RoutedEventArgs e)
        {
            UserControlMessageSent userControlMessageSent = new UserControlMessageSent();

            userControlMessageSent.changeText(messageTextBox.Text);
            userControlMessageSent.HorizontalAlignment = HorizontalAlignment.Right;
            if (selectedId != null && !selectedStatus)
            {
                MessageEvent @event = new MessageEvent("Send", "chat", selectedId, DateTime.Now, -1, messageTextBox.Text);
                ConnectToServer.SendRequest(@event);
            }
            //ConnectToServer.SendRequest($"send chat {selectedId} {DateTime.Now.ToShortTimeString()} {messageTextBox.Text}");
            else
            {
                MessageEvent @event = new MessageEvent("Send", "group", selectedId, DateTime.Now, -1, messageTextBox.Text);
                ConnectToServer.SendRequest(@event);
            }
            //ConnectToServer.SendRequest($"send group {selectedId} {DateTime.Now.ToShortTimeString()} {messageTextBox.Text}");
            userControlMessageSent.timeSent.Text = DateTime.Now.ToShortTimeString().ToString();
            messagePlace.Children.Add(userControlMessageSent);
            messageTextBox.Clear();
            scrollViewerMess.ScrollToBottom();
        }
Beispiel #7
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     ConnectToServer.Disconnect();
     Application.Current.Shutdown();
 }
Beispiel #8
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     ConnectToServer.Disconnect();
     Application.Current.Shutdown();
 }