/// <summary> /// Handler for the Client Exited Channel event /// </summary> private void TeamspeakService_ClientExitedChannel(object sender, TS3.Data.ClientEventArgs e) { Task.Factory.StartNew(() => { var notification = new TSNotificationViewModel(e.ClientID, e.ClientName, TSNotificationType.UserExited); Threading.InvokeOnUI(() => this.Notifications.Add(notification)); Thread.Sleep(5000); // Let channel notifications stay for 5 seconds Threading.InvokeOnUI(() => this.Notifications.Remove(notification)); }); }
/// <summary> /// Handler for the Client Exited Channel event /// </summary> private void TeamspeakService_ClientExitedChannel(object sender, TS3.Data.ClientEventArgs e) { if (this.UserData.ShowEnterExitChannelNotifications) { Task.Factory.StartNew(() => { var notification = new TSNotificationViewModel(e.ClientID, e.ClientName, TSNotificationType.UserExited); Threading.InvokeOnUI(() => this.Notifications.Add(notification)); Thread.Sleep(5000); // Let channel notifications stay for 5 seconds Threading.InvokeOnUI(() => this.Notifications.Remove(notification)); }); Threading.InvokeOnUI(() => { var client = this.CurrentChannelClients.FirstOrDefault(c => c.ID == e.ClientID); if (client != null) { this.CurrentChannelClients.Remove(client); } }); } }