bool valid()
        {
            if (Sname.Text.Trim() == string.Empty)
            {
                Sname.Focus();
                Sname.BorderStyle = BorderStyle.Solid;
                Sname.BorderColor = Color.Red;
                Sname.ToolTip     = "Enter Name";
                return(false);
            }

            if (Semail.Text.Trim() == string.Empty)
            {
                Semail.Focus();
                Semail.BorderStyle = BorderStyle.Solid;
                Semail.BorderColor = Color.Red;
                Semail.ToolTip     = "Enter Email";
                return(false);
            }

            if (Sdept.Text.Trim() == string.Empty)
            {
                Sdept.Focus();
                Sdept.BorderStyle = BorderStyle.Solid;
                Sdept.BorderColor = Color.Red;
                Sdept.ToolTip     = "Enter Department";
                return(false);
            }

            if (Sclg.Text.Trim() == string.Empty)
            {
                Sclg.Focus();
                Sclg.BorderStyle = BorderStyle.Solid;
                Sclg.BorderColor = Color.Red;
                Sclg.ToolTip     = "Enter College";
                return(false);
            }



            if (Spass.Text.Trim() == string.Empty)
            {
                Spass.Focus();
                Spass.BorderStyle = BorderStyle.Solid;
                Spass.BorderColor = Color.Red;
                Spass.ToolTip     = "Enter Password";
                return(false);
            }

            if (Scpass.Text.Trim() != Spass.Text)
            {
                Scpass.Focus();
                Scpass.BorderStyle = BorderStyle.Solid;
                Scpass.BorderColor = Color.Red;
                Scpass.ToolTip     = "Password Not Matched";
                return(false);
            }
            return(true);
        }
Example #2
0
 public SamsungFingerprintImplementation()
 {
     try
     {
         var spass = new Spass();
         spass.Initialize(Application.Context);
         _hasNoFingerPrintSensor = !spass.IsFeatureEnabled(Spass.DeviceFingerprint);
         _spassFingerprint       = new SpassFingerprint(Application.Context);
         IsCompatible            = true;
     }
     catch (SecurityException ex)
     {
         Log.Warn(nameof(SamsungFingerprintImplementation), ex);
         _hasNoPermission = true;
     }
     catch (Exception ex)
     {
         Log.Warn(nameof(SamsungFingerprintImplementation), ex);
         _hasNoApi = true;
     }
 }
 public SamsungFingerprintImplementation()
 {
     try
     {
         var spass = new Spass();
         spass.Initialize(Application.Context);
         _hasNoFingerPrintSensor = !spass.IsFeatureEnabled(Spass.DeviceFingerprint);
         _spassFingerprint = new SpassFingerprint(Application.Context);
         IsCompatible = true;
     }
     catch (SecurityException ex)
     {
         Log.Warn(nameof(SamsungFingerprintImplementation), ex);
         _hasNoPermission = true;
     }
     catch (Exception ex)
     {
         Log.Warn(nameof(SamsungFingerprintImplementation), ex);
         _hasNoApi = true;
     }
 }
        public SamsungBiometricsImpl() {
            //if (Android.OS.Build.VERSION == Android.OS.BuildVersionCodes.M)
            var spass = new Spass();

            try {
                spass.Initialize(Application.Context);
                if (spass.IsFeatureEnabled(Spass.DeviceFingerprint)) {
                    this.fingerprint = new SpassFingerprint(Application.Context);
                    this.available = this.fingerprint.HasRegisteredFinger;
                }
            }
            catch (SsdkUnsupportedException ex) {
                Debug.WriteLine("Error Initializing: " + ex);
            }
            catch (UnsupportedOperationException ex) {
                Debug.WriteLine("Fingerprint Not Supported: " + ex);
            }
            catch (SecurityException ex) {
                Debug.WriteLine("Invalid App Permissions: " + ex);
                //<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
            }
        }
Example #5
0
        public BiometricsImpl()
        {
            var spass = new Spass();

            try {
                spass.Initialize(Application.Context);
                if (spass.IsFeatureEnabled(Spass.DeviceFingerprint))
                {
                    this.fingerprint = new SpassFingerprint(Application.Context);
                    this.available   = this.fingerprint.HasRegisteredFinger;
                }
            }
            catch (SsdkUnsupportedException ex) {
                Debug.WriteLine("Error Initializing: " + ex);
            }
            catch (UnsupportedOperationException ex) {
                Debug.WriteLine("Fingerprint Not Supported: " + ex);
            }
            catch (SecurityException ex) {
                Debug.WriteLine("Invalid App Permissions: " + ex);
                //<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
            }
        }
        public FingerprintSamsungIdentifier(Context context)
        {
            _spass = new Spass();

            try
            {
                _spass.Initialize(context);
            }
            catch (SecurityException)
            {
                //"Did you add the permission to the AndroidManifest.xml?");
                throw;
            }

            if (_spass.IsFeatureEnabled(Spass.DeviceFingerprint))
            {
                _spassFingerprint = new SpassFingerprint(context);
            }
            else
            {
                throw new RuntimeException("Fingerprint Featue not available.");
            }
        }
Example #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);
            _listAdapter = new ArrayAdapter <string>(this, Resource.Layout.ListEntry, Resource.Id.TextView01);
            _listView    = FindViewById <ListView> (Resource.Id.listView1);

            if (_listView != null)
            {
                _listView.Adapter = _listAdapter;
            }

            _spass = new Spass();

            try {
                _spass.Initialize(this);
            } catch (SsdkUnsupportedException e) {
                Log(e.Message);
                return;
            } catch (SecurityException) {
                Log("Did you add the permission to the AndroidManifest.xml?");
                return;
            } catch (UnsupportedOperationException) {
                Log("Fingerprint Service is not supported in the device");
                return;
            }

            _isFeatureEnabled = _spass.IsFeatureEnabled(Spass.DeviceFingerprint);
            if (_isFeatureEnabled)
            {
                _spassFingerprint = new SpassFingerprint(this);
                Log("Fingerprint Service is supported in the device.");
                Log("SDK version : " + _spass.VersionName);
            }
            else
            {
                LogClear();
                Log("Fingerprint Service is not supported in the device.");
                return;
            }

            FindViewById(Resource.Id.buttonHasRegisteredFinger).Click += (sender, e) => {
                LogClear();
                try {
                    var hasRegisteredFinger = _spassFingerprint.HasRegisteredFinger;
                    Log("HasRegisteredFinger = " + hasRegisteredFinger);
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonIdentify).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            try {
                                _onReadyIdentify = true;
                                _spassFingerprint.StartIdentify(new IdentifyListener(_spassFingerprint,
                                                                                     Log, () => _onReadyIdentify = false));
                                Log("Please identify finger to verify you");
                            } catch (SpassInvalidStateException m) {
                                _onReadyIdentify = false;
                                if (m.Type == SpassInvalidStateException.StatusOperationDenied)
                                {
                                    Log("Exception: " + m.Message);
                                }
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonShowIdentifyDialogWithPW).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            try {
                                _onReadyIdentify = true;
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), true);
                                Log("Please identify finger to verify you");
                            } catch (SpassInvalidStateException m) {
                                _onReadyIdentify = false;
                                if (m.Type == SpassInvalidStateException.StatusOperationDenied)
                                {
                                    Log("Exception: " + m.Message);
                                }
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonShowIdentifyDialogWithoutPW).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            try {
                                _onReadyIdentify = true;
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), false);
                                Log("Please identify finger to verify you");
                            } catch (SpassInvalidStateException m) {
                                _onReadyIdentify = false;
                                if (m.Type == SpassInvalidStateException.StatusOperationDenied)
                                {
                                    Log("Exception: " + m.Message);
                                }
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonCancel).Click += (sender, e) => {
                LogClear();
                try {
                    if (_onReadyIdentify)
                    {
                        try {
                            _spassFingerprint.CancelIdentify();
                            Log("cancelIdentify is called");
                        } catch (IllegalStateException ise) {
                            Log(ise.Message);
                        }
                        _onReadyIdentify = false;
                    }
                    else
                    {
                        Log("Please request Identify first");
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonRegisterFinger).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_onReadyIdentify)
                    {
                        if (!_onReadyEnroll)
                        {
                            _onReadyEnroll = true;
                            _spassFingerprint.RegisteredFinger(this, new RegisterListener(Log, () => _onReadyEnroll = false));
                            Log("Jump to the Enroll screen");
                        }
                        else
                        {
                            Log("Please wait and try to register again");
                        }
                    }
                    else
                    {
                        Log("Please cancel Identify first");
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonGetRegisteredFingerprintName).Click += (sender, e) => {
                LogClear();
                try {
                    Log("=Fingerprint Name=");
                    var registeredFingerprintNames = _spassFingerprint.RegisteredFingerprintUniqueId;
                    if (registeredFingerprintNames == null)
                    {
                        Log("Registered fingerprints do not exist on this device");
                    }
                    else
                    {
                        int i = 0;
                        foreach (var registeredFingerprintName in registeredFingerprintNames)
                        {
                            Log("Index " + i + ", Name is " + registeredFingerprintName);
                            i++;
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonGetRegisteredFingerprintID).Click += (sender, e) => {
                LogClear();
                try {
                    if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintUniqueId))
                    {
                        try {
                            Log("=Fingerprint Unique ID=");
                            var registeredFingerprintIds = _spassFingerprint.RegisteredFingerprintUniqueId;
                            if (registeredFingerprintIds == null)
                            {
                                Log("Registered fingerprints do not exist on this device");
                            }
                            else
                            {
                                int i = 0;
                                foreach (var registedFingerprintId in registeredFingerprintIds)
                                {
                                    Log("Index " + i + ", Unique ID is " + registedFingerprintId);
                                    i++;
                                }
                            }
                        } catch (IllegalStateException ise) {
                            Log(ise.Message);
                        }
                    }
                    else
                    {
                        Log("To get Fingerprint ID is not supported in the device");
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonIdentifyWithIndex).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            try {
                                _onReadyIdentify = true;
                                if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintFingerIndex))
                                {
                                    var designatedFingers = new Java.Util.ArrayList();
                                    designatedFingers.Add(1);
                                    _spassFingerprint.SetIntendedFingerprintIndex(designatedFingers);
                                }
                                _spassFingerprint.StartIdentify(new IdentifyListener(_spassFingerprint,
                                                                                     Log, () => _onReadyIdentify = false));
                                Log("Please identify fingerprint index 1 to verify you");
                            } catch (SpassInvalidStateException ise) {
                                _onReadyIdentify = false;
                                if (ise.Type == SpassInvalidStateException.StatusOperationDenied)
                                {
                                    Log("Exception: " + ise.Message);
                                }
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonShowIdentifyDialogWithIndex).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            try {
                                _onReadyIdentify = true;
                                if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintFingerIndex))
                                {
                                    var designatedFingers = new Java.Util.ArrayList();
                                    designatedFingers.Add(2);
                                    designatedFingers.Add(3);
                                    _spassFingerprint.SetIntendedFingerprintIndex(designatedFingers);
                                }
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), false);
                                Log("Please identify fingerprint index 2 or 3 to verify you");
                            } catch (SpassInvalidStateException ise) {
                                _onReadyIdentify = false;
                                if (ise.Type == SpassInvalidStateException.StatusOperationDenied)
                                {
                                    Log("Exception: " + ise.Message);
                                }
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonShowIdentifyDialogWithTitleNLogo).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            _onReadyIdentify = true;
                            if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog))
                            {
                                try {
                                    _spassFingerprint.SetDialogTitle("Customized Dialog With Logo", 0x000000);
                                    _spassFingerprint.SetDialogIcon("Icon");
                                } catch (IllegalStateException ise) {
                                    Log(ise.Message);
                                }
                            }
                            try {
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), false);
                                Log("Please Identify fingerprint to verify you");
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonCustomizedDialogWithTransparency).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            _onReadyIdentify = true;
                            if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog))
                            {
                                try {
                                    _spassFingerprint.SetDialogTitle("Customized Dialog With Transparency", 0x000000);
                                    _spassFingerprint.SetDialogBgTransparency(0);
                                } catch (IllegalStateException ise) {
                                    Log(ise.Message);
                                }
                            }
                            try {
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), false);
                                Log("Please Identify fingerprint to verify you");
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };

            FindViewById(Resource.Id.buttonCustomizedDialogWithSetDialogDismiss).Click += (sender, e) => {
                LogClear();
                try {
                    if (!_spassFingerprint.HasRegisteredFinger)
                    {
                        Log("Please register finger first");
                    }
                    else
                    {
                        if (!_onReadyIdentify)
                        {
                            _onReadyIdentify = true;
                            if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog))
                            {
                                try {
                                    _spassFingerprint.SetDialogTitle("Customized Dialog With Setting Dialog dismiss", 0x000000);
                                    _spassFingerprint.SetCanceledOnTouchOutside(true);
                                } catch (IllegalStateException ise) {
                                    Log(ise.Message);
                                }
                            }
                            try {
                                _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint,
                                                                                                     Log, () => _onReadyIdentify = false), false);
                                Log("Please Identify fingerprint to verify you");
                            } catch (IllegalStateException ex) {
                                _onReadyIdentify = false;
                                Log("Exception: " + ex);
                            }
                        }
                        else
                        {
                            Log("Please cancel Identify first");
                        }
                    }
                } catch (UnsupportedOperationException) {
                    Log("Fingerprint Service is not supported in the device");
                }
            };
        }