Android.MainActivity.OnCreate C# (CSharp) Method

OnCreate() protected method

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

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            RequestedOrientation = ScreenOrientation.Portrait;

            Button button = FindViewById<Button> (Resource.Id.startScanningButton);

            // Setup BlinkID before usage
            initBlinkId ();

            if (!BlinkID.Instance.IsBlinkIDSupportedOnDevice (this)) {
                button.Enabled = false;
                Toast.MakeText (this, "BlinkID is not supported!", ToastLength.Long).Show ();
            } else {
                button.Click += delegate {
                    Console.WriteLine ("Native Scan is started");
                    try {
                        blinkId.Scan (blinkIdScanSettings);
                    } catch (IllegalScanSettingsException ex) {
                        Console.WriteLine (ex.Message);
                    }
                };
            }
        }