public Task <ReturnMessage> SetDefaultCamera(int cameraType, string cameraName)
        {
            Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus();

            if (checkTask != null)
            {
                return(checkTask);
            }

            var tcs = new TaskCallback <ReturnMessage>("SetDefaultCamera");

            if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name))
            {
                _meetingManager.TaskCallbacks.Remove(tcs.Name);
            }

            _meetingManager.TaskCallbacks.Add(tcs.Name, tcs);

            var result = MeetingAgent.SetDefaultCamera(cameraType, cameraName);

            if (result != 0)
            {
                return(Task.FromResult(MessageManager.SetDefaultCameraErrorMessage));
            }

            return(tcs.Task);
        }
        public Task <ReturnMessage> CreateMeeting(Attendee[] attendees)
        {
            Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus();

            if (checkTask != null)
            {
                return(checkTask);
            }

            var tcs = new TaskCallback <ReturnMessage>("CreateMeeting");

            if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name))
            {
                _meetingManager.TaskCallbacks.Remove(tcs.Name);
            }

            _meetingManager.TaskCallbacks.Add(tcs.Name, tcs);

            List <ContactInfo> contactInfos = new List <ContactInfo>();

            foreach (var attendee in attendees)
            {
                ContactInfo newContactInfo = new ContactInfo()
                {
                    m_szDisplayName = attendee.Name,
                    m_szPhoneId     = attendee.Id
                };

                contactInfos.Add(newContactInfo);
            }

            int result = MeetingAgent.CreateMeeting(contactInfos.ToArray(), contactInfos.Count);

            if (result != 0)
            {
                Task <ReturnMessage> resulTask;
                switch (result)
                {
                case 13:
                    resulTask = Task.FromResult(MessageManager.CameraNotSet);
                    break;

                case 14:
                    resulTask = Task.FromResult(MessageManager.MicrophoneNotSet);
                    break;

                case 15:
                case -1009:
                    resulTask = Task.FromResult(MessageManager.SpeakerNotSet);
                    break;

                default:
                    resulTask = Task.FromResult(MessageManager.FailedToCreateMeeting);
                    break;
                }
                return(resulTask);
            }

            return(tcs.Task);
        }