CABarCode.MainActivity.OnCreate C# (CSharp) Method

OnCreate() protected method

protected OnCreate ( Bundle bundle ) : void
bundle Bundle
return void
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Log.Info("MainActivity.OnCreate", "Started CABarCode!!!");

            #region Step 1. Setup UI elements

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

            // Get our button from the layout resource,
            // and attach an event to it
            var button = FindViewById<Button>(Resource.Id.scan_button);
            _upcCode = FindViewById<EditText>(Resource.Id.upc_code);

            #endregion

            #region Step 2. Wireup click event

            button.Click += delegate { StartActivityForResult(BarcodeScanner.Scan(), 0); };

            #endregion
        }