Exemplo n.º 1
0
        public static void SendRequest(OpenCorrespondence @event)
        {
            var jSend = JsonConvert.SerializeObject(@event, Formatting.Indented);

            byte[] data = Encoding.Unicode.GetBytes(jSend.ToString());
            stream.Write(data, 0, data.Length);
        }
Exemplo n.º 2
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;
        }
        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);
        }