private void base_SendMessage(object sender, EventArgs args) { AddToChat(network.LocalNode, inputTextView.Buffer.Text); Message message = network.SendPrivateMessage(node, inputTextView.Buffer.Text); AckMethod method = new AckMethod(); method.Method += (AckMethod.MethodEventHandler)DispatchService.GuiDispatch(new AckMethod.MethodEventHandler(OnMessageReceived)); method.MessageID = message.MessageID; network.AckMethods.Add(method.MessageID, method); Core.LoggingService.LogDebug("Sending message..."); }
private void messageSenderSendButton_Clicked(object sender, EventArgs args) { TreeIter iter; if (messageSenderToComboBox.GetActiveIter(out iter)) { var network = (Network)messageSenderToComboBox.Model.GetValue(iter, 1); var node = (Node)messageSenderToComboBox.Model.GetValue(iter, 2); for (var x = 0; x < 10; x++) { var thread = new Thread(delegate() { try { for (var y = 0; y < 10; y++) { var kilobytes = messageSenderSizeSpinButton.Value; var data = new string('X', (int)kilobytes * 1024); var message = new Message(network, MessageType.Test); message.To = node.NodeID; message.Content = data; var m = new AckMethod(); m.Method += MessageSent; network.AckMethods.Add(message.MessageID, m); network.SendRoutedMessage(message); Gtk.Application.Invoke(delegate { messageSenderLogTextView.Buffer.Text += "\nSending..."; }); } } catch (Exception ex) { Gtk.Application.Invoke(delegate { messageSenderLogTextView.Buffer.Text += "\n" + ex; }); } }); thread.Start(); } } }