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); }