コード例 #1
0
        async Task <bool> SetupAsync()
        {
            var task  = new TaskCompletionSource <bool>();
            var token = await TokenControll.RecuperarToken();

            var accessManager = TwilioAccessManagerFactory.CreateAccessManager(token, this);

            Client = TwilioIPMessagingSDK.CreateIPMessagingClientWithAccessManager(accessManager, this);

            IChannel[] channelo = Client.Channels.GetChannels();


            Client.Channels.LoadChannelsWithListener(new StatusListener
            {
                SuccessHandler = () =>
                {
                    IChannel[] channel = Client.Channels.GetChannels();
                    GeneralChannel     = Client.Channels.GetChannelByUniqueName("general");

                    if (GeneralChannel != null)
                    {
                        GeneralChannel.Listener = this;
                        JoinGeneralChannel();
                    }
                    else
                    {
                        CreateAndJoinGeneralChannel();
                    }

                    task.SetResult(true);
                }
            });

            return(await task.Task.ConfigureAwait(false));
        }
コード例 #2
0
        async Task <bool> Conectar()
        {
            var task  = new TaskCompletionSource <bool>();
            var token = await TokenControll.RecuperarToken();

            var accessManager = TwilioAccessManagerFactory.CreateAccessManager(token, this);

            Client = TwilioIPMessagingSDK.CreateIPMessagingClientWithAccessManager(accessManager, this);

            return(await task.Task.ConfigureAwait(false));
        }