private async Task Login()
        {
            var account = AccountText.Text;

            AgoraRtm.Current = account;

            var token = await AgoraTokenService.GetRtmToken(account);

            AgoraRtm.RtmKit.LoginByToken(token, account, (status) =>
            {
                if (status == Xamarin.Agora.AgoraRtmLoginErrorCode.Ok)
                {
                    InvokeOnMainThread(() =>
                    {
                        AgoraRtm.OneToOneMessageType = OfflineSwitch.On ? OneToOneMessageType.Offline : OneToOneMessageType.Normal;
                        //getting offline messages
                        var rtmDelegate            = new RtmDelegate();
                        rtmDelegate.AppendMessage += (user, message) => AgoraRtm.AddOfflineMessage(message, user);
                        AgoraRtm.UpdateKit(rtmDelegate);

                        AgoraRtm.Status = LoginStatus.Online;
                        PerformSegue("mainToTab", null);
                    });
                }
            });
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            AddKeyboradObserver();
            UpdateViews();
            TableView.DataSource = new TableSource(list);

            _rtmDelegate = new RtmDelegate();
            _rtmDelegate.AppendMessage += AppendMsg;

            AgoraRtm.UpdateKit(_rtmDelegate);

            inputTextField.ShouldReturn += ShouldReturn;
        }