示例#1
0
        public void PopUpImage(byte[] bytes, string message, Action done = null, string title = "", string okButton = "OK")
        {
            Application.SynchronizationContext.Post(ignored =>
            {
                if (CurrentActivity == null)
                {
                    return;
                }

                var customView = CurrentActivity.LayoutInflater.Inflate(Resource.Layout.PopUp_Image, null);
                var imageView  = (ImageView)customView.FindViewById(Resource.Id.popUpImageView);

                var converter = new MvxInMemoryImageValueConverter();
                var bitmap    = (Bitmap)converter.Convert(bytes, typeof(Bitmap), null, null);
                imageView.SetImageBitmap(bitmap);

                // Scale the image view to use maximum width
                SetImageViewSize(customView, imageView, bitmap);

                new AlertDialog.Builder(CurrentActivity)
                .SetView(customView)
                .SetMessage(message)
                .SetTitle(title)
                .SetPositiveButton(okButton, (s, e) =>
                {
                    if (done != null)
                    {
                        done();
                    }
                })
                .Show();
            }, null);
        }
示例#2
0
 static ImageValueConverter()
 {
     _converter = new MvxInMemoryImageValueConverter();
 }
 public void Include(MvxInMemoryImageValueConverter converter)
 {
     converter.Convert(null, typeof(UIImage), null, CultureInfo.CurrentCulture);
 }