public void Start()
    {
        _ambassador = (Ambassador) FindObjectOfType(typeof(Ambassador));
        _control = GetComponent<PlayerControl>();
        _health = GetComponent<HealthSystem>();

        if(_ambassador == null
           || _control == null
           || _health == null)
        {
            if(DebugMode)
                Debug.LogWarning("Was unable to find player controls or ambassador!" + Environment.NewLine
                                 + "Ambassador: " + ((_ambassador == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Player Controls: " + ((_control == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Health System: " + ((_health == null) ? "Not Found" : "Found"));

            return;
        }

        _control.canOverthrust = _ambassador.HasItem(OverthrustSkill);
        _control.canUnderthrust = _ambassador.HasItem(UnderthrustSkill);
        _health.HP = _ambassador.MaxHP;
        _health.MaxHP = _ambassador.MaxHP;

        if(DebugMode)
            Debug.Log("Player " + (_control.canOverthrust ? "can" : "cannot") + " perform Overthrust." + Environment.NewLine
                      + "Player " + (_control.canUnderthrust ? "can" : "cannot") + " perform Underthrust."
                      + "Player's HP: " + _health.HP + "/" + _health.MaxHP);
    }
Beispiel #2
0
    public void Start()
    {
        _ambassador = (Ambassador)FindObjectOfType(typeof(Ambassador));
        _control    = GetComponent <PlayerControl>();
        _health     = GetComponent <HealthSystem>();

        if (_ambassador == null ||
            _control == null ||
            _health == null)
        {
            if (DebugMode)
            {
                Debug.LogWarning("Was unable to find player controls or ambassador!" + Environment.NewLine
                                 + "Ambassador: " + ((_ambassador == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Player Controls: " + ((_control == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Health System: " + ((_health == null) ? "Not Found" : "Found"));
            }

            return;
        }

        _control.canOverthrust  = _ambassador.HasItem(OverthrustSkill);
        _control.canUnderthrust = _ambassador.HasItem(UnderthrustSkill);
        _health.HP    = _ambassador.MaxHP;
        _health.MaxHP = _ambassador.MaxHP;

        if (DebugMode)
        {
            Debug.Log("Player " + (_control.canOverthrust ? "can" : "cannot") + " perform Overthrust." + Environment.NewLine
                      + "Player " + (_control.canUnderthrust ? "can" : "cannot") + " perform Underthrust."
                      + "Player's HP: " + _health.HP + "/" + _health.MaxHP);
        }
    }
Beispiel #3
0
        private void DeviceSelected(object sender, RoutedEventArgs e)
        {
            RadioButton rb = (sender as RadioButton);

            try
            {
                checkFinger.SetText("");
                arrowClicked = true;
                // If Provider has an active device
                if (rb.Content is IFingerDevice)
                {
                    Ambassador.SetCallback(DispatchMessage);
                    _currDevice = rb.Content as IFingerDevice;
                    _currDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
                    checkFinger.IsDeviceConnected = true;
                }
                else
                {
                    checkFinger.IsDeviceConnected = false;
                }
                ShowState();
            }
            catch (Exception ex)
            {
                Auxiliary.Logger._log.Error(ex);
            }
        }
    public void Start()
    {
        _ambassador   = (Ambassador)FindObjectOfType(typeof(Ambassador));
        _damageSource = GetComponent <DamageSource>();

        if (_ambassador == null ||
            _damageSource == null)
        {
            if (DebugMode)
            {
                Debug.LogWarning("Was unable to find damage source or ambassador!" + Environment.NewLine
                                 + "Ambassador: " + ((_ambassador == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Damage Source: " + ((_damageSource == null) ? "Not Found" : "Found"));
            }

            return;
        }

        if (CanBreakBreakables)
        {
            if (DebugMode)
            {
                Debug.Log("This damage trigger can break breakable objects.");
            }

            _damageSource.AffectedTags.AddRange(BreakableItemTags);
        }
        else
        {
            if (DebugMode)
            {
                Debug.Log("This damage trigger can't break breakables.");
            }
        }
    }
    public void Start()
    {
        _ambassador = (Ambassador) FindObjectOfType(typeof(Ambassador));
        _damageSource = GetComponent<DamageSource>();

        if(_ambassador == null
           || _damageSource == null)
        {
            if(DebugMode)
                Debug.LogWarning("Was unable to find damage source or ambassador!" + Environment.NewLine
                                 + "Ambassador: " + ((_ambassador == null) ? "Not Found" : "Found") + Environment.NewLine
                                 + "Damage Source: " + ((_damageSource == null) ? "Not Found" : "Found"));

            return;
        }

        if(_ambassador.HasItem(ItemName))
        {
            if(DebugMode)
                Debug.Log("This damage trigger can break breakable objects.");

            _damageSource.AffectedTags.AddRange(BreakableItemTags);
        }
        else
        {
            if(DebugMode)
                Debug.Log("This damage trigger can't break breakables.");
        }
    }
Beispiel #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Ambassador ambassador = db.Ambassadors.Find(id);

            db.Ambassadors.Remove(ambassador);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
 private void UserControl_Unloaded(object sender,RoutedEventArgs e)
 {
     if (currentDevice != null)
     {
         currentDevice.Dispatch(COMMAND.ENROLLMENT_STOP);
     }
     Ambassador.ClearCallback();
 }
Beispiel #8
0
        public void Inicijalizuj()
        {
            ICQRSRead      read       = new CQRSRead();
            ICQRSWrite     write      = new CQRSWrite();
            IEventSourcing es         = new EventSourcing(read, write);
            IAmbassador    ambassador = new Ambassador(es);

            _readWrite = new ReadWrite();
            IUser iu = new User(ambassador);
        }
    void Start()
    {
        _ambassador = Ambassador.Instance;

        // This url must remain a secret, to prevent 'enhancements' to players' scores.
        _leaderBoard = DreamloLeaderBoard.GetSceneDreamloLeaderboard();
        _leaderBoard.WebServiceUrl = _specialUrl;
        _leaderBoard.PrivateCode = _privateCode;
        _leaderBoard.PublicCode = _publicCode;
    }
Beispiel #10
0
        public void DeviceFailure(Object sender)
        {
            // only for our device
            foreach (var radioButton in TestDevicePanel.Children.OfType <RadioButton>().Where(rb => rb.Content == sender))
            {
                radioButton.Content = sender.ToString();

                Ambassador.ClearCallback();
                MessageSend(sender, "Connect device and press refresh");
                radioButton.IsEnabled = true;
            }
        }
Beispiel #11
0
    public void Start()
    {
        _ambassador     = Ambassador.Instance;
        _questGUI       = GetComponent <QuestGUI>();
        _maestro        = Maestro.DetectLastInstance();
        _fader          = (Fader)FindObjectOfType(typeof(Fader));
        _saveFileAccess = _ambassador.gameObject.GetComponent <SaveFileAccess>();

        PauseHud.Initialize(_maestro);
        PauseForm.Initialize(_maestro);
        SettingsForm.Initialize(_maestro);
    }
Beispiel #12
0
 public ActionResult Edit([Bind(Include = "Id,Name,ContactNo,FacebookId,EmailId,CNIC,InstituteId,StatusId,CreatedAt,Address,CityOfResidence,Degree,PreviousExperiance,AmbassadorCategoryId,Hostelite")] Ambassador ambassador)
 {
     if (ModelState.IsValid)
     {
         ambassador.CreatedAt       = DateTime.Now;
         db.Entry(ambassador).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AmbassadorCategoryId = new SelectList(db.AmbassadorCategories, "Id", "Category", ambassador.AmbassadorCategoryId);
     ViewBag.InstituteId          = new SelectList(db.Institutes, "Id", "Institute1");
     ViewBag.StatusId             = new SelectList(db.RequestStatus, "Id", "Status", ambassador.StatusId);
     return(View(ambassador));
 }
Beispiel #13
0
        // GET: Ambassadors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ambassador ambassador = db.Ambassadors.Find(id);

            if (ambassador == null)
            {
                return(HttpNotFound());
            }
            return(View(ambassador));
        }
    void Start()
    {
        _ambassador = (Ambassador) FindObjectOfType(typeof(Ambassador));

        if(_ambassador == null)
        {
            if(DebugMode)
                Debug.LogWarning("An ambassador was not found!");

            return;
        }

        if(_ambassador.HasItem(SkillName))
            RemoveItemFromScene();
    }
Beispiel #15
0
 private void TestScannerDisable()
 {
     if (currentTestDevice != null)
     {
         if (currentTestDevice.Content is IFingerDevice)
         {
             (currentTestDevice.Content as IFingerDevice).Dispatch(COMMAND.LIVECAPTURE_STOP);
             Ambassador.ClearCallback();
             checkFinger.ClearImage();
         }
     }
     if (imageReseter != null)
     {
         imageReseter.Stop();
     }
 }
Beispiel #16
0
 public bool CheckIfReaderIsOnline(CaptureResult captureResult, Reader activeReader)
 {
     if (captureResult.ResultCode == Constants.ResultCode.DP_FAILURE ||
         captureResult.ResultCode == Constants.ResultCode.DP_INVALID_DEVICE)
     {
         Constants.ResultCode test = activeReader.GetStatus();
         if (test == Constants.ResultCode.DP_INVALID_DEVICE)
         {
             Id = Id + "FAILED";
             Ambassador.AddMessage(new MSignal(this, MSignal.SIGNAL.DEVICE_FAILURE));
             Console.WriteLine(captureResult.ResultCode);
             return(false);
         }
     }
     return(true);
 }
Beispiel #17
0
        // GET: Ambassadors/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ambassador ambassador = db.Ambassadors.Find(id);

            if (ambassador == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AmbassadorCategoryId = new SelectList(db.AmbassadorCategories, "Id", "Category", ambassador.AmbassadorCategoryId);
            ViewBag.InstituteId          = new SelectList(db.Institutes, "Id", "Institute1");
            ViewBag.StatusId             = new SelectList(db.RequestStatus, "Id", "Status", ambassador.StatusId);
            return(View(ambassador));
        }
Beispiel #18
0
    public void Start()
    {
        _maestro        = Maestro.DetectLastInstance();
        _ambassador     = Ambassador.Instance;
        _transition     = TransitionManager.Instance;
        _saveFileAccess = _ambassador.gameObject.GetComponent <SaveFileAccess>();

        MainForm.Initialize(_maestro);
        SettingsForm.Initialize(_maestro);
        CreditsForm.Initialize(_maestro);
        InstructionsForm.Initialize(_maestro);

        MainForm.SetVisibility(true);
        SettingsForm.SetVisibility(false);
        CreditsForm.SetVisibility(false);
        InstructionsForm.SetVisibility(false);
    }
Beispiel #19
0
 public AmbassadorDetailsVM(Ambassador ambassador)
 {
     Xsa         = ambassador;
     OpenCommand = new Command((openType) => {
         var openFor = openType.ToString().ToLower();
         if (openFor.CompareTo(Blog) == 0)
         {
             Device.OpenUri(new Uri(string.Format("http://{0}", Xsa.Blog)));
             return;
         }
         if (openFor.CompareTo(Twitter) == 0)
         {
             Device.OpenUri(new Uri(string.Format("twitter://{0}", Xsa.Twitter)));
             return;
         }
     });
 }
Beispiel #20
0
    public static Ambassador FindOldestInstance()
    {
        Ambassador[] objects = (Ambassador[])FindObjectsOfType(typeof(Ambassador));
        if (objects.Length == 0)
        {
            throw new Exception("Ambassador could not find any ambassadors in the scene!");
        }

        Ambassador oldest = objects.FirstOrDefault(a => a.IsInitialInstance == true);

        if (oldest == default(Ambassador))
        {
            oldest = objects.First();
            oldest.IsInitialInstance = true;
        }

        return(oldest);
    }
Beispiel #21
0
    void Start()
    {
        _ambassador = (Ambassador)FindObjectOfType(typeof(Ambassador));

        if (_ambassador == null)
        {
            if (DebugMode)
            {
                Debug.LogWarning("An ambassador was not found!");
            }

            return;
        }

        if (_ambassador.HasItem(SkillName))
        {
            RemoveItemFromScene();
        }
    }
Beispiel #22
0
 private void Window_Closing_1(object sender,CancelEventArgs e)
 {
     loggingService.Logout();
     IsConnected = false;
     foreach (var devCtrl in _pm.DeviceControls)
     {
         devCtrl.Dispose();
     }
     Ambassador.Dispose();
     if (_progressBar != null)
     {
         if (_fileOperationRes == BiosecLibClient.CryptoOperationRes.BIOSEC_NO_ERROR)
         {
             if (_options.IsSecure)
             {
                 _progressBar.HideWindowAfter(3000,"Encryption complete");
             }
             else
             {
                 _progressBar.HideWindowAfter(3000,"Decryption complete");
             }
         }
         else
         {
             _progressBar.Destroy();
         }
     }
     if (_errorWindow != null)
     {
         _errorWindow.Close();
     }
     _stopFillingList = true;
     if (_fileListFiller != null)
     {
         _fileListFiller.Join();
     }
     if (_fileChooser != null)
     {
         _fileChooser.Destroy();
     }
     _libClient.dispose();
 }
        public async Task <Ambassador> SignUpForAmbassador(int id)
        {
            var user = await _context.Users.Include(user => user.Ambassador)
                       .FirstOrDefaultAsync(user => user.Id == id);

            if (user.Ambassador != null)
            {
                throw new OneTimeUseException(" This email address is already registered ");
            }
            var ambassador = new Ambassador();

            user.Ambassador = ambassador;
            await _context.Ambassadors.AddAsync(ambassador);

            if (await _context.SaveChangesAsync() > 0)
            {
                return(ambassador);
            }
            throw new Exception("Problem in saving changes");
        }
Beispiel #24
0
        public ActionResult UpdateStatus(int?id, int?Status)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                try
                {
                    Ambassador volunteer = db.Ambassadors.Find(id);
                    if (volunteer == null)
                    {
                        return(HttpNotFound());
                    }
                    volunteer.StatusId = Status;
                    db.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    string message = "";
                    foreach (var validationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                        }
                    }

                    HomeController.EntityinfoMessage("Ambassodor status: " + message);
                    HomeController.EntitywriteErrorLog(ex);
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }

            return(RedirectToAction("Index"));
        }
Beispiel #25
0
        /// <summary>
        /// Call this function to end / abort enrollment process
        /// </summary>
        public void endEnrollment()
        {
            EnrollmentProgress.Value = 0;

            currentDevice.Dispatch(COMMAND.ENROLLMENT_STOP);
            Ambassador.ClearCallback();

            //currentDevice.StopEnrollment();
            UpdateFingers();
            isBusy = false;
            if (_controlType == ControlTypeEnum.FINGERPRINT_CONTROL_TYPE)
            {
                fingerDisplay.ClearImage();
                fingerChooser.DeSelectFinger(fingerNum);
            }
            else if (_controlType == ControlTypeEnum.PALM_CONTROL_TYPE)
            {
                palmEnrollControl.SetOriginalColor();
            }
            Cancel.Visibility            = Visibility.Collapsed;
            UpdateBtn.Visibility         = Visibility.Visible;
            ProviderBox.IsEnabled        = true;
            EnrollmentProgress.IsEnabled = false;

            Ambassador.SetCallback(DispatchMessage);
            currentDevice.Dispatch(COMMAND.SINGLECAPTURE_START);
            //showMessageBase("Please, select finger to enroll or touch the scanner to verify it");
            switch (_controlType)
            {
            case ControlTypeEnum.FINGERPRINT_CONTROL_TYPE:
                forceShowMessageBase(baseHint);
                break;

            case ControlTypeEnum.PALM_CONTROL_TYPE:
                forceShowMessageBase(baseHint);
                break;

            default:
                break;
            }
        }
Beispiel #26
0
        private void DeviceDeselected(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = (sender as RadioButton);

            try
            {
                // If Provider has an active device
                if (radioButton.Content is IFingerDevice)
                {
                    IFingerDevice device = (sender as RadioButton).Content as IFingerDevice;
                    Ambassador.ClearCallback();

                    device.Dispatch(COMMAND.LIVECAPTURE_STOP);
                    (sender as RadioButton).IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                Auxiliary.Logger._log.Error(ex);
            }
        }
Beispiel #27
0
    public void Start()
    {
        _ambassador = (Ambassador)FindObjectOfType(typeof(Ambassador));
        _maestro    = Maestro.DetectLastInstance();

        if (_ambassador == null)
        {
            if (DebugMode)
            {
                Debug.LogWarning("Was unable to find damage source or ambassador!" + Environment.NewLine
                                 + "Ambassador: " + (_ambassador == null ? "Not Found" : "Found"));
            }

            return;
        }

        if (DebugMode)
        {
            Debug.Log("This weapon " + (DeflectsBlueMagic ? "can" : "can't") + " repel Blue Magic.");
        }
    }
Beispiel #28
0
        void TestPageDeviceSelected(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = (sender as RadioButton);

            try
            {
                // If Provider has an active device
                if (radioButton.Content is IFingerDevice)
                {
                    currentTestDevice           = (sender as RadioButton);
                    currentTestDevice.IsEnabled = false;
                    IFingerDevice device = (sender as RadioButton).Content as IFingerDevice;

                    TestScannerPage.Children.Clear();
                    checkFinger = new FingerDisplay();
                    TestScannerPage.Children.Add(checkFinger);

                    //checkFinger.SetText("Please, touch the scanner");
                    Ambassador.SetCallback(DispatchMessage);
                    device.Dispatch(COMMAND.LIVECAPTURE_START);
                    imageReseter.Start();
                }
                else
                {
                    Ambassador.ClearCallback();
                    if (checkFinger != null)
                    {
                        TestScannerPage.Children.Clear();
                        checkFinger = null;
                    }
                    checkFinger = new FingerDisplay(Properties.Resources.no_device);
                    TestScannerPage.Children.Add(checkFinger);
                    checkFinger.SetText("Connect device and press refresh");
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Beispiel #29
0
        public void DeviceFailure(Object sender)
        {
            // only for our device
            foreach (var radioButton in TestDevicePanel.Children.OfType <RadioButton>().Where(rb => rb.Content == sender))
            {
                radioButton.Content = sender.ToString();

                checkFinger.SetText("");
                textClearTimerStop();
                Ambassador.ClearCallback();
                if (checkFinger != null)
                {
                    TestScannerPage.Children.Clear();
                    checkFinger = null;
                }
                checkFinger = new FingerDisplay(Properties.Resources.no_device);
                TestScannerPage.Children.Add(checkFinger);
                MessageSend(sender, "Connect device and press refresh");

                radioButton.IsEnabled = true;
            }
        }
Beispiel #30
0
        private void deviceThread()
        {
            STATE   state = STATE.IDLE;
            COMMAND com   = COMMAND.NONE;
            List <FingerTemplate> templates = new List <FingerTemplate>();

            byte[] image       = null;
            Int32  iError      = 1;
            int    enrollCount = 0;
            int    quality     = 50;

            iError = m_FPM.Init(devName);
            iError = m_FPM.OpenDevice(devId);

            GetInfo();

            try
            {
                while (true)
                {
                    cancelToken.Token.ThrowIfCancellationRequested();

                    if (state == STATE.IDLE)
                    {
                        com = queue.Take(cancelToken.Token);
                    }
                    else
                    {
                        // non blocking take
                        if (queue.Count > 0)
                        {
                            com = queue.Take();
                        }
                    }

                    switch (com)
                    {
                    case COMMAND.LIVECAPTURE_START:
                        state = STATE.TEST;
                        break;

                    case COMMAND.ENROLLMENT_START:
                        state       = STATE.GETFINGER;
                        enrollCount = 0;
                        templates.Clear();
                        break;

                    case COMMAND.SINGLECAPTURE_START:
                        state = STATE.GETSINGLE;
                        break;

                    case COMMAND.SINGLECAPTURE_STOP:
                    case COMMAND.LIVECAPTURE_STOP:
                    case COMMAND.ENROLLMENT_STOP:
                        state = STATE.IDLE;
                        break;
                    }
                    com = COMMAND.NONE;

                    switch (state)
                    {
                    case STATE.TEST:
                        SendBaseMessage("Please, touch the scanner");
//                            iError = m_FPM.SetLedOn(false);

                        image = new Byte[m_ImageWidth * m_ImageHeight];
                        try
                        {
                            iError = m_FPM.GetImageEx(image, TIMEOUT_CAPTURE, 0, ENROLL_QUALITY);
                        }
                        catch (Exception ex)
                        {
                        }
                        if (iError == (Int32)SGFPMError.ERROR_NONE)
                        {
                            OnBiometricsCaptured(new FingerImageSG(_BSPCode, image, m_ImageWidth, m_ImageHeight));
                        }
                        else if (iError == (Int32)SGFPMError.ERROR_TIME_OUT)
                        {
                            OnBiometricsCaptured(null);
                            Thread.Sleep(TIMEOUT_AFTER_CAPTURE);
                        }
                        else if ((iError != (Int32)SGFPMError.ERROR_INVALID_PARAM) && (iError != (Int32)SGFPMError.ERROR_LINE_DROPPED))
                        {
                            state = STATE.OFFLINE;
                            Ambassador.AddMessage(new MSignal(this, MSignal.SIGNAL.DEVICE_FAILURE));
                        }

                        break;

                    case STATE.GETSINGLE:
                        SendBaseMessage("Please, touch the scanner");
                        image = new Byte[m_ImageWidth * m_ImageHeight];
                        state = STATE.GETSINGLEIMAGE;
                        break;

                    case STATE.GETSINGLEIMAGE:
                        //                         iError = m_FPM.SetLedOn(false);
                        image  = new Byte[m_ImageWidth * m_ImageHeight];
                        iError = m_FPM.GetImageEx(image,TIMEOUT_CAPTURE,0,ENROLL_QUALITY);
                        if (iError == 0)
                        {
                            OnSingleCaptured(new FingerImageSG(_BSPCode,image,m_ImageWidth,m_ImageHeight));
                            image = new Byte[m_ImageWidth * m_ImageHeight];
                            state = STATE.SINGLELIFT;
                        }
                        else if (iError == (Int32)SGFPMError.ERROR_TIME_OUT)
                        {
                            Thread.Sleep(TIMEOUT_AFTER_CAPTURE);
                        }
                        else if ((iError != (Int32)SGFPMError.ERROR_INVALID_PARAM) && (iError != (Int32)SGFPMError.ERROR_LINE_DROPPED))
                        {
                            state = STATE.OFFLINE;
                            Ambassador.AddMessage(new MSignal(this,MSignal.SIGNAL.DEVICE_FAILURE));
                        }
                        break;

                    case STATE.SINGLELIFT:
                        //                           iError = m_FPM.SetLedOn(false);
                        iError = m_FPM.GetImageEx(image,10,0,ENROLL_QUALITY);
                        if (iError != 0)
                        {
                            state = STATE.GETSINGLE;
                        }
                        else
                        {
                            Thread.Sleep(TIMEOUT_AFTER_CAPTURE);
                        }

                        break;

                    case STATE.GETFINGER:
                        SendBaseMessage("Please, touch the scanner");
                        image = new Byte[m_ImageWidth * m_ImageHeight];
                        state = STATE.GETIMAGE;
                        break;

                    case STATE.GETIMAGE:
//                            iError = m_FPM.SetLedOn(false);
                        iError = m_FPM.GetImageEx(image,10,0,ENROLL_QUALITY);
                        if (iError == 0)
                        {
                            enrollCount++;
                            FingerImageSG fingerImage = new FingerImageSG(_BSPCode,image,m_ImageWidth,m_ImageHeight);
                            TemplateSG    tmpl        = Extract(fingerImage) as TemplateSG;
                            templates.Add(tmpl);

                            OnBiometricsCaptured(fingerImage);
                            OnSendProgressMessage((enrollCount) * 33);

                            if (enrollCount < 3)
                            {
                                state = STATE.GETEMPTY;
                            }
                            else
                            {
                                state = STATE.FINISHENROLL;
                            }
                        }
                        else if (iError == (Int32)SGFPMError.ERROR_TIME_OUT)
                        {
                            Thread.Sleep(TIMEOUT_AFTER_CAPTURE);
                        }
                        else if ((iError != (Int32)SGFPMError.ERROR_INVALID_PARAM) && (iError != (Int32)SGFPMError.ERROR_LINE_DROPPED))
                        {
                            state = STATE.OFFLINE;
                            Ambassador.AddMessage(new MSignal(this,MSignal.SIGNAL.DEVICE_FAILURE));
                        }
                        break;

                    case STATE.GETEMPTY:
                        SendBaseMessage("Please, lift your finger up");
                        image = new Byte[m_ImageWidth * m_ImageHeight];
                        state = STATE.GETEMPTYIMAGE;
                        break;

                    case STATE.GETEMPTYIMAGE:
//                            iError = m_FPM.SetLedOn(false);
                        iError = m_FPM.GetImageEx(image,10,0,ENROLL_QUALITY);
                        if (iError != 0)
                        {
                            state = STATE.GETFINGER;
                        }
                        else
                        {
                            Thread.Sleep(TIMEOUT_AFTER_CAPTURE);
                        }
                        break;

                    case STATE.FINISHENROLL:
                        state = STATE.IDLE;
                        foreach (var template in templates)
                        {
                            bool matched = false;
                            m_FPM.MatchTemplate((template as TemplateSG).Bytes,(templates[templates.Count - 1] as TemplateSG).Bytes,SGFPMSecurityLevel.NORMAL,ref matched);
                            if (!matched)
                            {
                                SendPopUpMessage("Can't create template, please repeat");
                                OnBiometricsEnrolled(null);
                                OnSendProgressMessage(0);
                            }
                            OnSendProgressMessage(100);
                        }
                        SendPopUpMessage("Successfully registered");
                        OnBiometricsEnrolled(templates.ToList());     // return new copy of list
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                m_FPM.CloseDevice();
            }
        }
 void Start()
 {
     _ambassador = Ambassador.FindOldestInstance();
 }
Beispiel #32
0
 public void Start()
 {
     _maestro = Maestro.DetectLastInstance();
     _ambassador = Ambassador.Instance;
     _transition = TransitionManager.Instance;
 }
Beispiel #33
0
 // Use this for initialization
 void Start()
 {
     _ambassador = (Ambassador) FindObjectOfType(typeof(Ambassador));
     DeleteIfCannotUse();
 }
Beispiel #34
0
        public ActionResult Create([Bind(Include = "Id,Name,ContactNo,FacebookId,EmailId,CNIC,InstituteId,StatusId,CreatedAt,Address,CityOfResidence,Degree,PreviousExperiance,AmbassadorCategoryId,Hostelite,Why,ExpectationsFromSEE")] Ambassador ambassador)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var obj = db.Ambassadors.FirstOrDefault(s => s.EmailId == ambassador.EmailId || s.ContactNo == ambassador.ContactNo);
                    if (obj != null)
                    {
                        ViewBag.ErrorMessage = "Email Or Phone No. Already Exists!";
                        ViewBag.InstituteId  = new SelectList(db.Institutes, "Id", "Institute1");

                        ViewBag.AmbassadorCategoryId = new SelectList(db.AmbassadorCategories, "Id", "Category", ambassador.AmbassadorCategoryId);
                        ViewBag.StatusId             = new SelectList(db.RequestStatus, "Id", "Status", ambassador.StatusId);
                        return(View(ambassador));
                    }
                    try
                    {
                        ambassador.ExpectationsFromSEE = Request.Form["ExpectationsFromSEE"];
                        ambassador.CreatedAt           = DateTime.Now;
                        ambassador.StatusId            = 1;
                        db.Ambassadors.Add(ambassador);
                        db.SaveChanges();
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "You are successfully registerd for Ambassador with your crdentials,Team SEE Lahore will soon respond you through Email.Stay Connected for Bigest Event of Lahore, See Lahore 2018", url = controllerName + "/" + actionName }));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        string message = "";
                        foreach (var validationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                            }
                        }

                        HomeController.EntityinfoMessage(ambassador.Name + ": " + message);
                        HomeController.EntitywriteErrorLog(ex);
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
                    }
                }


                ViewBag.InstituteId = new SelectList(db.Institutes, "Id", "Institute1");

                ViewBag.AmbassadorCategoryId = new SelectList(db.AmbassadorCategories, "Id", "Category", ambassador.AmbassadorCategoryId);
                ViewBag.StatusId             = new SelectList(db.RequestStatus, "Id", "Status", ambassador.StatusId);
                return(View(ambassador));
            }
            catch (Exception ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
            }
        }
Beispiel #35
0
 // Use this for initialization
 void Start()
 {
     _ambassador = (Ambassador)FindObjectOfType(typeof(Ambassador));
     DeleteIfCannotUse();
 }
Beispiel #36
0
 public void Start()
 {
     _ambassador = GetComponent <Ambassador>();
     _transition = GetComponent <TransitionManager>();
 }
Beispiel #37
0
    public void Start()
    {
        _ambassador = Ambassador.Instance;

        EnableEffect();
    }
 public void Start()
 {
     _textProviders = (EntityText[]) FindObjectsOfType(typeof(EntityText));
     _ambassador = (Ambassador) FindObjectOfType(typeof(Ambassador));
     _maestro = (Maestro) FindObjectOfType(typeof(Maestro));
 }
 public void Start()
 {
     _ambassador = Ambassador.Instance;
     EvaluatePhase();
 }