private void Current_OnPass(string obj) { this.RunOnUiThread(() => { var message = JsonConvert.DeserializeObject <Message>(obj); var view = LinearLayout.Inflate(this, Resource.Layout.visitor, null); var ivFace = view.FindViewById <ImageView>(Resource.Id.iv_face); var tvWeclome = view.FindViewById <TextView>(Resource.Id.tv_weclome); var tvName = view.FindViewById <TextView>(Resource.Id.tv_name); var data = Convert.FromBase64String(message.face); var faceImage = Android.Graphics.BitmapFactory.DecodeByteArray(data, 0, data.Length); tvName.Text = message.name; if (message.type == "ok") { tvWeclome.Text = "Welcome"; var color = Android.Graphics.Color.Argb(0xff, 0xff, 0x6a, 0); tvWeclome.SetTextColor(color); tvName.SetTextColor(color); } else { tvWeclome.Text = "Compare failure,Please try again"; var color = Android.Graphics.Color.Argb(0xff, 0xff, 0, 0); tvWeclome.SetTextColor(color); tvName.SetTextColor(color); } ivFace.SetImageBitmap(faceImage); faceImage.Dispose(); var builder = new AlertDialog.Builder(this); builder.SetView(view); var dialog = builder.Create(); dialog.Window.SetGravity(GravityFlags.Top); dialog.Show(); Task.Factory.StartNew(() => { Thread.Sleep(Config.Profile.Delay); faceImage?.Dispose(); dialog.Dismiss(); }); }); }