Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SendBirdClient.Init("52C4347B-C9B0-4E62-81D6-96EB40517902");

            //SendBirdClient.Connect("tom", (User user, SendBirdException e) =>
            //{
            //    if (e != null)
            //    {
            //        // Error
            //        return;
            //    }
            //});

            OpenChannel.GetChannel("sendbird_open_channel_43739_172b1997dcc4c9bbfc49bc0533303c8017bb2d70", (OpenChannel openChannel, SendBirdException e) => {
                if (e != null)
                {
                    // Error!
                    return;
                }

                Console.WriteLine("canale aperto");
                // Successfully fetched the channel.
                // Do something with openChannel.
            });

            Console.Read();
        }
Ejemplo n.º 2
0
        public void joinChannelHandler(object sender, EventArgs e)
        {
            OpenChannel.GetChannel("testing", (channel, sendExcep) =>
            {
                if (sendExcep != null)
                {
                    // An error has occurred while connecting.
                    System.Diagnostics.Debug.WriteLine("An error has occurred " +
                                                       "in joinChannelHandler while joining");
                    System.Diagnostics.Debug.WriteLine("error: " + sendExcep.Code);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Success in joining a channel in SendBird!");
                }

                channel.Enter((SendBirdException enterExcep) =>
                {
                    if (enterExcep != null)
                    {
                        System.Diagnostics.Debug.WriteLine("An error has occurred " +
                                                           "in joinChannelHandler while entering");
                        System.Diagnostics.Debug.WriteLine("error: " + sendExcep.Code);
                    }
                });

                channel.SendUserMessage("Test", (message, sendUserTestE) =>
                {
                    if (sendUserTestE != null)
                    {
                        System.Diagnostics.Debug.WriteLine("Error occurred when sending user message" +
                                                           " from inside joinChannelHandler");
                        System.Diagnostics.Debug.WriteLine("error: " + sendUserTestE.Code);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Successfully sent message");
                    }
                });
            });
        }
Ejemplo n.º 3
0
    public void EnterChannel(string CHANNEL_URL)
    {
        OpenChannel.GetChannel(CHANNEL_URL, (OpenChannel openChannel, SendBirdException e) =>
        {
            if (e != null)
            {
                // Error.
                return;
            }
            _openChannel = openChannel;
            _openChannel.Enter((SendBirdException e3) =>
            {
                if (e3 != null)
                {
                    // Error.
                    return;
                }

                GetPreviousOpenChannelData();
            });
        });
    }