Exemple #1
0
        protected override async void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate(bundle);

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

            _mPreview           = FindViewById <CameraSourcePreview>(Resource.Id.preview);
            _mGraphicOverlay    = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay);
            _switchCamBtn       = FindViewById <ImageButton>(Resource.Id.imageButton1);
            _trainNewFaceButton = FindViewById <ImageButton>(Resource.Id.trainNewFaceButton);
            //greetingsText = FindViewById<TextView>(Resource.Id.greetingsTextView);


            var personLoggedIn = this.Intent.Extras.GetString("Person");

            Console.WriteLine(personLoggedIn + "--------");
            jsonOfLoggedInPerson = JObject.Parse(personLoggedIn);

            Toast.MakeText(this, "Welcome back " + jsonOfLoggedInPerson.GetValue("Name") + "!", ToastLength.Long).Show();


            _switchCamBtn.Click       += SwichCamBtnClick;
            _trainNewFaceButton.Click += _trainNewFaceButton_Click;


            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted)
            {
                CreateCameraSource(CameraFacing.Front);
                //LiveCamHelper.Init();
                //LiveCamHelper.GreetingsCallback = (s) => { RunOnUiThread(()=> GreetingsText = s ); };
                //await LiveCamHelper.RegisterFaces();
            }
            else
            {
                RequestCameraPermission();
            }
        }
Exemple #2
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            mPreview        = FindViewById <CameraSourcePreview>(Resource.Id.preview);
            mGraphicOverlay = FindViewById <GraphicOverlay>(Resource.Id.faceOverlay);
            //greetingsText = FindViewById<TextView>(Resource.Id.greetingsTextView);


            if (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted)
            {
                CreateCameraSource();
                LiveCamHelper.Init();
                LiveCamHelper.GreetingsCallback = (s) => { RunOnUiThread(() => GreetingsText = s); };
                //await LiveCamHelper.RegisterFaces();
            }
            else
            {
                RequestCameraPermission();
            }
        }