Ejemplo n.º 1
0
		public async void initializeChat()
		{

			TwilioIPMessagingSDK.SetLogLevel((int)Android.Util.LogPriority.Debug);

			if (!TwilioIPMessagingSDK.IsInitialized)
			{
				Console.WriteLine("Initialize");

				TwilioIPMessagingSDK.InitializeSDK(ctx, new InitListener
				{
					InitializedHandler = async delegate
					{
						await Setup();
					},
					ErrorHandler = err =>
					{
						Console.WriteLine(err.Message);
					}
				});
			}
			else {
				await Setup();
			}
		}
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.ActionBar.Subtitle = "logging in...";

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            sendButton  = FindViewById <Button>(Resource.Id.sendButton);
            textMessage = FindViewById <EditText>(Resource.Id.messageTextField);
            listView    = FindViewById <ListView>(Resource.Id.listView);

            adapter          = new MessagesAdapter(this);
            listView.Adapter = adapter;

            TwilioIPMessagingSDK.SetLogLevel((int)Android.Util.LogPriority.Debug);

            if (!TwilioIPMessagingSDK.IsInitialized)
            {
                Console.WriteLine("Initialize");

                TwilioIPMessagingSDK.InitializeSDK(this, new InitListener
                {
                    InitializedHandler = async delegate
                    {
                        await Setup();
                    },
                    ErrorHandler = err =>
                    {
                        Console.WriteLine(err.Message);
                    }
                });
            }
            else
            {
                await Setup();
            }

            sendButton.Click += ButtonSend_Click;
        }