Exemplo n.º 1
0
        protected override void OnViewModelSet()
        {
            RequestWindowFeature(WindowFeatures.ActionBar);

            SetContentView(Resource.Layout.Page_EntryView);

            _imagePhoto = FindViewById <ImageView>(Resource.Id.imagePhoto);

            ViewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName.Equals("EntryImage"))
                {
                    if (ViewModel.HasImage)
                    {
                        var converter = new Base64ToBitmapDrawableConverter();
                        var drawable  = (BitmapDrawable)converter.Convert(ViewModel.EntryImage.ImageBase64, typeof(BitmapDrawable), null, CultureInfo.CurrentCulture);

                        _imagePhoto.SetImageDrawable(drawable);
                    }
                    else
                    {
                        _imagePhoto.SetImageResource(0);
                    }
                }
            };

            ViewModel.LoadEntry();
        }
Exemplo n.º 2
0
        protected override void OnViewModelSet()
        {
            SetContentView(Resource.Layout.Page_EditEntryView);

            var imagePhoto     = this.FindViewById <ImageView>(Resource.Id.imagePhoto);
            var buttonAddPhoto = this.FindViewById <Button>(Resource.Id.buttonAddPhoto);

            buttonAddPhoto.Click += (s, e) =>
            {
                this.ShowQuestion("Add Photo", "Would you like to Choose an existing photo or Take a New one?", "Take New", "Choose Existing",
                                  () => addPhoto(true), () => addPhoto(false));
            };

            this.ViewModel.PropertyChanged += (s, e) =>
            {
                switch (e.PropertyName)
                {
                case "EntryImage":
                    if (this.ViewModel.HasImage)
                    {
                        var converter = new Base64ToBitmapDrawableConverter();
                        var drawable  = (BitmapDrawable)converter.Convert(this.ViewModel.EntryImage.ImageBase64, typeof(BitmapDrawable), null, System.Globalization.CultureInfo.CurrentCulture);
                        imagePhoto.SetImageDrawable(drawable);
                    }
                    break;
                }
            };

            this.ViewModel.LoadEntry();
        }
Exemplo n.º 3
0
        protected override void OnViewModelSet()
        {
            SetContentView(Resource.Layout.Page_EntryView);

            this.imagePhoto = this.FindViewById <ImageView>(Resource.Id.imagePhoto);

            this.ViewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName.Equals("EntryImage"))
                {
                    if (this.ViewModel.HasImage)
                    {
                        var converter = new Base64ToBitmapDrawableConverter();
                        var drawable  = (BitmapDrawable)converter.Convert(this.ViewModel.EntryImage.ImageBase64, typeof(BitmapDrawable), null, System.Globalization.CultureInfo.CurrentCulture);

                        this.imagePhoto.SetImageDrawable(drawable);
                    }
                }
            };

            this.ViewModel.LoadEntry();
        }