private void Disconnect() { biliLiveListener.Disconnected += BiliLiveListener_Disconnected; ConnectBtn.IsEnabled = false; ConnectBtn.Content = Application.Current.Resources["Disconnecting"].ToString(); RoomIdBox.IsEnabled = true; biliLiveListener.Disconnect(); if (biliLiveInfo != null) { biliLiveInfo.StopInfoListener(); } }
private void ListenBtn_Click(object sender, RoutedEventArgs e) { ListenBtn.IsEnabled = false; if (biliLiveListener == null) { ListenBtn.Content = "Connecting"; biliLiveListener = new BiliLiveListener(2746439, BiliLiveListener.Protocols.Tcp); biliLiveListener.Connected += BiliLiveListener_Connected; biliLiveListener.ConnectionFailed += BiliLiveListener_ConnectionFailed; biliLiveListener.JsonsRecieved += BiliLiveListener_JsonsRecieved; biliLiveListener.Connect(); } else { ListenBtn.Content = "Disconnecting"; biliLiveListener.Disconnected += BiliLiveListener_Disconnected; biliLiveListener.Disconnect(); biliLiveListener = null; } }