private void OnMicCommandExecute(SecureCommandArgs args) { if (args != null) { MicType micType = (MicType)args.Content; if (Me.MicStatus == MicStatusMessage.MicStatus_Off) { RoomClient.OnMic(RoomVM.Id, micType, -1); } else { switch (micType) { case MicType.Private: PrivateMicUserVMs.Remove(Me); break; case MicType.Secret: SecretMicUserVMs.Remove(Me); break; case MicType.Public: switch (Me.MicIndex) { case 0: FirstMicUserVM = null; break; case 1: SecondMicUserVM = null; break; case 2: ThirdMicUserVM = null; break; } break; } RoomClient.DownMic(RoomVM.Id, micType, Me.MicIndex); Me.DownMic(); updateMicImage(Me.Id, false);// update the local image manually as the downmic meesage will not be received by itself. } } }
private void MicStatusMessageReceivedEventHandler(int arg1, MicStatusMessage arg2) { if (arg1 == RoomVM.Id) { var uvm = UserVMs.FirstOrDefault(u => u.Id == arg2.UserId); if (uvm != null) { switch (arg2.MicAction) { #region OnMic case MicAction.OnMic: { switch (arg2.MicType) { case MicType.Public: { switch (arg2.MicIndex) { case 0: FirstMicUserVM = uvm; break; case 1: SecondMicUserVM = uvm; break; case 2: ThirdMicUserVM = uvm; break; } } break; case MicType.Private: if (!PrivateMicUserVMs.Contains(uvm)) { PrivateMicUserVMs.Add(uvm); } break; case MicType.Secret: if (!SecretMicUserVMs.Contains(uvm)) { SecretMicUserVMs.Add(uvm); } break; default: break; } uvm.OnMic(arg2.MicType, arg2.MicIndex, arg2.StreamGuid, arg2.MicStatus); updateMicImage(uvm.Id, true); } break; #endregion #region DownMic case MicAction.DownMic: { switch (arg2.MicType) { case MicType.Public: switch (arg2.MicIndex) { case 0: FirstMicUserVM = null; break; case 1: SecondMicUserVM = null; break; case 2: ThirdMicUserVM = null; break; } break; case MicType.Private: PrivateMicUserVMs.Remove(uvm); break; case MicType.Secret: SecretMicUserVMs.Remove(uvm); break; } } uvm.DownMic(); updateMicImage(uvm.Id, false); break; #endregion #region Toggle case MicAction.Toggle: { uvm.Toggle(arg2.MicStatus); } break; #endregion } } } }