private void LoadedAsync()
        {
            var openedViews = _viewLayoutService.ViewFrameList.Where(v => v.IsOpened);

            var attendees = from openedView in openedViews
                            select new AttendeeItem()
            {
                Text          = openedView.ViewName,
                Id            = openedView.PhoneId,
                Hwnd          = openedView.Hwnd,
                ButtonCommand = DelegateCommand <AttendeeItem> .FromAsyncHandler(async (attendeeItem) =>
                {
                    var specialView =
                        _viewLayoutService.ViewFrameList.FirstOrDefault(
                            v => v.PhoneId == attendeeItem.Id && v.Hwnd == attendeeItem.Hwnd);

                    if (!CheckIsUserSpeaking(specialView, true))
                    {
                        return;
                    }

                    _viewLayoutService.SetSpecialView(specialView, _targetSpecialViewType);
                    await _viewLayoutService.LaunchLayout();
                    _selectAttendeeListView.Close();
                })
            };

            attendees.ToList().ForEach(attendee =>
            {
                AttendeeItems.Add(attendee);
            });

            InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
            //InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
        }
        private void LoadedAsync()
        {
            List <Participant> participants = new List <Participant>();

            participants.Add(_windowManager.Participant);

            foreach (var participant in _windowManager.Participants)
            {
                participants.Add(participant);
            }

            var attendees = from p in participants
                            select new AttendeeItem()
            {
                Text = p.Account.AccountName,
                Id   = p.Account.AccountId.ToString(),
                //Hwnd = videobox.Handle,
                ButtonCommand = new DelegateCommand <AttendeeItem>((attendeeItem) =>
                {
                    _windowManager.VideoBoxManager.SetProperty(_targetSpecialViewType.ToString(), attendeeItem.Text);


                    _windowManager.LayoutChange(WindowNames.MainWindow, _targetSpecialViewType);
                    _selectAttendeeListView.Close();
                })
            };

            attendees.ToList().ForEach(attendee =>
            {
                AttendeeItems.Add(attendee);
            });

            InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
            //InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
        }
예제 #3
0
        private void GetAttendeesAsync()
        {
            var attendees = _meetingService.GetParticipants();

            attendees.Result.ToList().ForEach(attendee =>
            {
                var trueAttendee = GlobalData.Instance.Classrooms.FirstOrDefault(o => o.SchoolRoomNum == attendee.AccountId.ToString());
                AttendeeItems.Add(new AttendeeItem()
                {
                    AttendeeName = $"{trueAttendee?.SchoolRoomName}  [{attendee.AccountId}]"
                });
            });

            InputSimulatorManager.Instance.InputSimu.Keyboard.KeyPress(VirtualKeyCode.TAB);
        }
        private void LoadedAsync()
        {
            List <Participant> participants = new List <Participant>();

            participants.Add(_windowManager.Participant);

            foreach (var participant in _windowManager.Participants)
            {
                participants.Add(participant);
            }

            participants.ForEach(view =>
            {
                AttendeeItems.Add(new AttendeeItem()
                {
                    Text =
                        view.Account.AccountId.ToString() == GlobalData.TryGet(CacheKey.HostId).ToString()
                            ? "我"
                            : _userInfos.FirstOrDefault(user => user.GetNube() == view.Account.AccountId.ToString())?.Name,
                    Content       = view.IsSpeaking ? CancelSpeaking : SetSpeaking,
                    Id            = view.Account.AccountId.ToString(),
                    ButtonCommand = view.Account.AccountId.ToString() == GlobalData.TryGet(CacheKey.HostId).ToString()
                        ? new DelegateCommand <AttendeeItem>(async(self) =>
                    {
                        switch (self.Content)
                        {
                        case CancelSpeaking:
                            var stopSpeakMsg = await _meetingSdkAgent.AskForStopSpeak();
                            if (stopSpeakMsg.StatusCode != 0)
                            {
                                self.Content = CancelSpeaking;
                                MessageQueueManager.Instance.AddInfo(stopSpeakMsg.Message);
                            }
                            else
                            {
                                self.Content = SetSpeaking;
                            }
                            break;

                        case SetSpeaking:
                            var startSpeakMsg = await _meetingSdkAgent.AskForSpeak();
                            if (startSpeakMsg.StatusCode != 0)
                            {
                                self.Content = SetSpeaking;
                                MessageQueueManager.Instance.AddInfo(startSpeakMsg.Message);
                            }
                            else
                            {
                                self.Content = CancelSpeaking;
                            }
                            break;
                        }
                    })
                        : new DelegateCommand <AttendeeItem>(async(attendeeItem) =>
                    {
                        switch (attendeeItem.Content)
                        {
                        case CancelSpeaking:

                            //AsyncCallbackMsg stopCallbackMsg = _sdkService.RequireUserStopSpeak(attendeeItem.Id);
                            int stopSpeakCmd     = (int)UiMessage.BannedToSpeak;
                            var sendStopSpeakMsg = await _meetingSdkAgent.AsynSendUIMsg(stopSpeakCmd, int.Parse(attendeeItem.Id), "");

                            if (sendStopSpeakMsg.StatusCode != 0)
                            {
                                attendeeItem.Content = CancelSpeaking;
                                MessageQueueManager.Instance.AddInfo(sendStopSpeakMsg.Message);
                            }
                            else
                            {
                                attendeeItem.Content = SetSpeaking;
                            }

                            break;

                        case SetSpeaking:
                            //AsyncCallbackMsg startCallbackMsg = _sdkService.RequireUserSpeak(attendeeItem.Id);

                            int startSpeakCmd     = (int)UiMessage.AllowToSpeak;
                            var sendStartSpeakMsg = await _meetingSdkAgent.AsynSendUIMsg(startSpeakCmd, int.Parse(attendeeItem.Id), "");


                            if (sendStartSpeakMsg.StatusCode != 0)
                            {
                                attendeeItem.Content = SetSpeaking;
                                MessageQueueManager.Instance.AddInfo(sendStartSpeakMsg.Message);
                            }
                            else
                            {
                                attendeeItem.Content = CancelSpeaking;
                            }

                            break;
                        }
                    })
                });
            });

            //InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
            InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
        }
        private void LoadedAsync()
        {
            var participants = _sdkService.GetParticipants();

            participants.ForEach(view =>
            {
                AttendeeItems.Add(new AttendeeItem()
                {
                    Text =
                        view.PhoneId == _sdkService.SelfPhoneId
                            ? "我"
                            : _userInfos.FirstOrDefault(user => user.GetNube() == view.PhoneId)?.Name,
                    Content       = view.IsSpeaking ? CancelSpeaking : SetSpeaking,
                    Id            = view.PhoneId,
                    ButtonCommand = view.PhoneId == _sdkService.SelfPhoneId
                        ? new DelegateCommand <AttendeeItem>(async(self) =>
                    {
                        switch (self.Content)
                        {
                        case CancelSpeaking:
                            AsyncCallbackMsg stopSpeakMsg = await _sdkService.StopSpeak();
                            if (stopSpeakMsg.HasError)
                            {
                                self.Content = CancelSpeaking;
                                MessageQueueManager.Instance.AddInfo(stopSpeakMsg.Message);
                            }
                            else
                            {
                                self.Content = SetSpeaking;
                            }
                            break;

                        case SetSpeaking:
                            AsyncCallbackMsg startSpeakMsg = await _sdkService.ApplyToSpeak();
                            if (startSpeakMsg.HasError)
                            {
                                self.Content = SetSpeaking;
                                MessageQueueManager.Instance.AddInfo(startSpeakMsg.Message);
                            }
                            else
                            {
                                self.Content = CancelSpeaking;
                            }
                            break;
                        }
                    })
                        : new DelegateCommand <AttendeeItem>((attendeeItem) =>
                    {
                        switch (attendeeItem.Content)
                        {
                        case CancelSpeaking:

                            //AsyncCallbackMsg stopCallbackMsg = _sdkService.RequireUserStopSpeak(attendeeItem.Id);
                            int stopSpeakCmd = (int)UiMessage.BannedToSpeak;
                            AsyncCallbackMsg sendStopSpeakMsg = _sdkService.SendMessage(stopSpeakCmd,
                                                                                        stopSpeakCmd.ToString(), stopSpeakCmd.ToString().Length, attendeeItem.Id);

                            if (sendStopSpeakMsg.HasError)
                            {
                                attendeeItem.Content = CancelSpeaking;
                                MessageQueueManager.Instance.AddInfo(sendStopSpeakMsg.Message);
                            }
                            else
                            {
                                attendeeItem.Content = SetSpeaking;
                            }

                            break;

                        case SetSpeaking:
                            //AsyncCallbackMsg startCallbackMsg = _sdkService.RequireUserSpeak(attendeeItem.Id);

                            int startSpeakCmd = (int)UiMessage.AllowToSpeak;
                            AsyncCallbackMsg sendStartSpeakMsg = _sdkService.SendMessage(startSpeakCmd,
                                                                                         startSpeakCmd.ToString(), startSpeakCmd.ToString().Length, attendeeItem.Id);


                            if (sendStartSpeakMsg.HasError)
                            {
                                attendeeItem.Content = SetSpeaking;
                                MessageQueueManager.Instance.AddInfo(sendStartSpeakMsg.Message);
                            }
                            else
                            {
                                attendeeItem.Content = CancelSpeaking;
                            }

                            break;
                        }
                    })
                });
            });

            //InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
            InputSimulatorManager.Instance.Simulator.Keyboard.KeyPress(VirtualKeyCode.TAB);
        }