private void QueryDispatcher_ReadyForSendingCommands(object sender, System.EventArgs e) { Model.ConnectionState = ConnectionState.Connected; // you can only run commands on the queryrunner when this event has been raised first! QueryRunner = new QueryRunner(QueryDispatcher); QueryRunner.Notifications.ChannelTalkStatusChanged += Notifications_ChannelTalkStatusChanged; QueryRunner.RegisterForNotifications(ClientNotifyRegisterEvent.Any); MessageBox.Show("Ready"); }
private void QueryDispatcher_ReadyForSendingCommands(object sender, System.EventArgs e) { try { QueryRunner = new QueryRunner(QueryDispatcher); QueryRunner.Notifications.ChannelTalkStatusChanged += Notifications_ChannelTalkStatusChanged; QueryRunner.RegisterForNotifications(ClientNotifyRegisterEvent.Any); this.state = State.Connected; setupClientAndChannel(); state = State.Connected; } catch { state = State.Disconnected; Reconnect(); } }
/// <summary> /// Ready for sending commands /// </summary> private void QueryDispatcher_ReadyForSendingCommands(object sender, System.EventArgs e) { if (!Keep_Alive_Timer.Enabled) Keep_Alive_Timer.Start(); // you can only run commands on the queryrunner when this event has been raised first! try { QueryRunner = new QueryRunner(QueryDispatcher); //check if whoami returns a valid user, if erroneous teamspeak is not connected to a server //try connecting again later. if ((currentUser = QueryRunner.SendWhoAmI()).IsErroneous) { Disconnect(); return; } Retry_Connection_Timer.Stop(); Connected = ConnectionState.Connected; //QueryRunner.Notifications.ChannelTalkStatusChanged += Notifications_ChannelTalkStatusChanged; //QueryRunner.Notifications.ClientMoved += Notifications_ClientMoved; QueryRunner.Notifications.MessageReceived += Notifications_MessageReceived; QueryRunner.RegisterForNotifications(ClientNotifyRegisterEvent.Any); } catch (Exception) { Disconnect(); } }