private async Task ParticipateOrWatchAsync()
        {
            ResponseResult meetingResult = await _bmsService.GetMeetingByLessonId(CurLessonDetail.Id.ToString());


            Log.Logger.Debug(
                $"【get meetingId by lessonId result】:result={meetingResult.Status}, msg={meetingResult.Message}, data={meetingResult.Data}");

            if (HasErrorMsg(meetingResult.Status, meetingResult.Message))
            {
                return;
            }

            if (meetingResult.Data == null)
            {
                HasErrorMsg("-1", Messages.WarningNullDataFromServer);
                return;
            }

            switch (meetingResult.Data.ToString())
            {
            case "-1":
                HasErrorMsg("-1", Messages.WarningYouNeedCreateAMeeting);

                //create a meeting and update to database
                AsyncCallbackMsg createMeetingResult = await _sdkService.CreateInstantMeeting(new Participant[0]);

                Log.Logger.Debug(
                    $"【create meeting result】:result={createMeetingResult.Status}, msg={createMeetingResult.Message}");

                if (
                    !HasErrorMsg(createMeetingResult.Status.ToString(),
                                 createMeetingResult.Message))
                {
                    ResponseResult updateResult =
                        await _bmsService.UpdateMeetingId(CurLessonDetail.Id, _sdkService.MeetingId);

                    if (!HasErrorMsg(updateResult.Status, updateResult.Message))
                    {
                        await GotoMeeting(_sdkService.MeetingId);
                    }
                }

                break;

            case "0":
                //someone is creating a meeting, just wait
                HasErrorMsg("-1", Messages.WarningSomeoneIsCreatingAMeeting);

                break;

            default:
                int meetingId = int.Parse(meetingResult.Data.ToString());

                await GotoMeeting(meetingId);

                break;
            }
        }
예제 #2
0
        //command handlers
        private async Task CreateMeetingAsync()
        {
            AsyncCallbackMsg createMeetingResult = await _sdkService.CreateInstantMeeting(new Participant[0]);

            if (HasErrorMsg(createMeetingResult.Status.ToString(), createMeetingResult.Message))
            {
                return;
            }

            await GotoMeetingViewAsync();
        }