private void btnConnect_Click(object sender, EventArgs e) { string name = textBoxUserName.Text; string pass = textBoxUserPassword.Text; int port; string addr; if (textBoxServer.Text.Contains(':')) { var server = textBoxServer.Text.Split(':'); addr = server[0]; port = Int32.Parse(server[1]); } else { addr = textBoxServer.Text; port = 64738; } if (connection != null) { connection.Close(); connection = null; protocol.Close(); tvUsers.Nodes.Clear(); } connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); while (connection.Protocol.LocalUser == null) { connection.Process(); } }
private static void UpdateLoop(MumbleConnection connection) { while (connection.State != ConnectionStates.Disconnected) { connection.Process(); } }
private void mumbleUpdater_Tick(object sender, EventArgs e) { if (connection != null) { connection.Process(); } }
private void mumbleUpdater_Tick(object sender, EventArgs e) { if (connection != null) { if (connection.Process()) { Thread.Yield(); } else { Thread.Sleep(1); } } }
private static void UpdateLoop(MumbleConnection connection, out Exception exception) { exception = null; try { while (connection.State != ConnectionStates.Disconnected) { if (connection.Process()) { Thread.Yield(); } else { Thread.Sleep(1); } } } catch (Exception ex) { exception = ex; } }
private void button2_Click(object sender, EventArgs e) { string name = textBox1.Text; string pass = ""; int port = 64738; string addr = textBox2.Text; if (connection != null) { connection.Close(); connection = null; protocol.Close(); tvUsers.Nodes.Clear(); } connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol); connection.Connect(name, pass, new string[0], addr); while (connection.Protocol.LocalUser == null) { connection.Process(); } }
public Form1() { InitializeComponent(); connection = new MumbleConnection("mumble.placeholder-software.co.uk", 64738); protocol = connection.Connect <BasicMumbleProtocol>("testuser", "", "mumble.placeholder-software.co.uk"); protocol.MessageRecieved += Protocol_MessageRecieved; while (connection.Protocol.LocalUser == null) { connection.Process(); } Dictionary <uint, ChannelTree> channels = new Dictionary <uint, ChannelTree>(); foreach (var channel in protocol.Channels) { channels.Add(channel.Id, new ChannelTree(channel)); } foreach (var channelTree in channels.Values) { if (channelTree.Channel.Id != 0) { channelTree.Parent = channels[channelTree.Channel.Parent]; channelTree.Parent.Children.Add(channelTree); } } foreach (var user in protocol.Users) { channels[user.Channel.Id].Users.Add(user); } ChannelTree RootChannel = channels[0]; tvUsers.Nodes.Add(MakeNode(RootChannel)); tvUsers.ExpandAll(); //MessageBox.Show("Connected as " + connection.Protocol.LocalUser.Id); }
private static void UpdateLoop(MumbleConnection connection) { while (true) connection.Process(); }