private void InviteInRoom(object obj) { try { using (var client = ClientModel.Get()) { var allUsers = client.Chat.GetUsers(); var availableUsers = allUsers.Select(u => u.Nick).Except(Users.Select(u => u.Nick)); if (!availableUsers.Any()) { AddSystemMessage(Localizer.Instance.Localize(NoBodyToInviteKey)); return; } var dialog = new UsersOperationDialog(InviteInRoomTitleKey, availableUsers); if (dialog.ShowDialog() == true) { ClientModel.Api.Perform(new ClientInviteUsersAction(Name, dialog.Users)); } } } catch (SocketException se) { AddSystemMessage(se.Message); } }
private void KickFromRoom(object obj) { try { var dialog = new UsersOperationDialog(KickFormRoomTitleKey, Users.Select(u => u.Nick)); if (dialog.ShowDialog() == true) { ClientModel.Api.Perform(new ClientKickUsersAction(Name, dialog.Users)); } } catch (SocketException se) { AddSystemMessage(se.Message); } }
private void KickFromRoom(object obj) { try { var dialog = new UsersOperationDialog(KickFormRoomTitleKey, Users); if (dialog.ShowDialog() == true && ClientModel.Api != null) { ClientModel.Api.KickUsers(Name, dialog.Users); } } catch (SocketException se) { AddSystemMessage(se.Message); } }
private void InviteInRoom(object obj) { try { var availableUsers = MainViewModel.AllUsers.Except(Users); if (!availableUsers.Any()) { AddSystemMessage(Localizer.Instance.Localize(NoBodyToInviteKey)); return; } var dialog = new UsersOperationDialog(InviteInRoomTitleKey, availableUsers); if (dialog.ShowDialog() == true && ClientModel.Api != null) { ClientModel.Api.InviteUsers(Name, dialog.Users); } } catch (SocketException se) { AddSystemMessage(se.Message); } }