<commit_before>﻿using System;
using Xamarin.Forms;
using ZXing.Net.Mobile.Forms;
using ZXing.Net.Mobile.Forms.Android;
using Android.Runtime;
using Android.App;
using Xamarin.Forms.Platform.Android;
using Android.Views;
using System.ComponentModel;
using System.Reflection;
using Android.Widget;
using ZXing.Mobile;
using System.Threading.Tasks;

[assembly:ExportRenderer(typeof(ZXingBarcodeImageView), typeof(ZXingBarcodeImageViewRenderer))]
namespace ZXing.Net.Mobile.Forms.Android
{
    [Preserve(AllMembers = true)]
    public class ZXingBarcodeImageViewRenderer : ViewRenderer<ZXingBarcodeImageView, ImageView>
    {       
        public static void Init ()
        {
            var temp = DateTime.Now;
        }

        ZXingBarcodeImageView formsView;
        ImageView imageView;

        protected override void OnElementChanged(ElementChangedEventArgs<ZXingBarcodeImageView> e)
        {
            formsView = Element;

            if (imageView == null) {

                imageView = new ImageView (Xamarin.Forms.Forms.Context);

                base.SetNativeControl (imageView);     
            }

            if (formsView != null && formsView.BarcodeValue != null)
            {
                var writer = new ZXing.Mobile.BarcodeWriter();

                if (formsView != null && formsView.BarcodeOptions != null)
                    writer.Options = formsView.BarcodeOptions;
                if (formsView != null && formsView.BarcodeFormat != null)
                    writer.Format = formsView.BarcodeFormat;

                var value = formsView != null ? formsView.BarcodeValue : string.Empty;

                var image = writer.Write(value);

                imageView.SetImageBitmap(image);
            }

            base.OnElementChanged (e);
        }
    }<commit_msg>Forms: Added override for property changed on barcode image view (fixes #233)<commit_after>﻿using System;
using Xamarin.Forms;
using ZXing.Net.Mobile.Forms;
using ZXing.Net.Mobile.Forms.Android;
using Android.Runtime;
using Xamarin.Forms.Platform.Android;
using System.ComponentModel;
using Android.Widget;
using ZXing.Mobile;

[assembly:ExportRenderer(typeof(ZXingBarcodeImageView), typeof(ZXingBarcodeImageViewRenderer))]
namespace ZXing.Net.Mobile.Forms.Android
{
    [Preserve(AllMembers = true)]
    public class ZXingBarcodeImageViewRenderer : ViewRenderer<ZXingBarcodeImageView, ImageView>
    {       
        public static void Init ()
        {
            var temp = DateTime.Now;
        }

        ZXingBarcodeImageView formsView;
        ImageView imageView;

        protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
        {
            regenerate ();

            base.OnElementPropertyChanged (sender, e);
        }

        protected override void OnElementChanged(ElementChangedEventArgs<ZXingBarcodeImageView> e)
        {
            formsView = Element;

            if (imageView == null) {

                imageView = new ImageView (Xamarin.Forms.Forms.Context);

                base.SetNativeControl (imageView);     
            }

            regenerate ();

            base.OnElementChanged (e);
        }

        void regenerate ()
        {
            if (formsView != null && formsView.BarcodeValue != null)
            {
                var writer = new ZXing.Mobile.BarcodeWriter();

                if (formsView != null && formsView.BarcodeOptions != null)
                    writer.Options = formsView.BarcodeOptions;
                if (formsView != null && formsView.BarcodeFormat != null)
                    writer.Format = formsView.BarcodeFormat;

                var value = formsView != null ? formsView.BarcodeValue : string.Empty;

                var image = writer.Write(value);

                imageView.SetImageBitmap(image);
            }
        }
    }
{'fraction_non_alphanumeric': 0.08719275549805951, 'fraction_numerical': 0.0007761966364812419, 'mean_word_length': 2.2297410192147034, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2277720', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1005, 'n_words': 216}