Esempio n. 1
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     if (pictureEdit1.Image == null)
     {
         return;
     }
     if (MainForm.Engine.DetectAllFaces(((Bitmap)pictureEdit1.Image).ConvertFrom(), null).Length > 0)
     {
         foreach (BcIdentificationServer identificationServer in BcIdentificationServer.LoadAll())
         {
             try
             {
                 IdentificationServerClient identificationServerClient = new IdentificationServerClient(new InstanceContext(_client));
                 identificationServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)identificationServer.Ip + ":" + (string)(object)identificationServer.Port + "/FaceIdentification/IdentificationServer");
                 identificationServerClient.Open();
                 List <Guid> list = new List <Guid>();
                 foreach (CheckedListBoxItem checkedListBoxItem in lvObjects.Items)
                 {
                     if (checkedListBoxItem.CheckState == CheckState.Checked)
                     {
                         list.Add((Guid)checkedListBoxItem.Value);
                     }
                 }
                 _startDate = DateTime.Now;
                 marqueeProgressBarControl1.Visible = true;
                 _maintimer.Enabled = true;
             }
             catch (Exception ex)
             {
                 int num = (int)XtraMessageBox.Show(ex.Message, Messages.IdentificationServerUnavailble, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
     else
     {
         int num1 = (int)XtraMessageBox.Show(Messages.NoFaceWasFound, Messages.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Esempio n. 2
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (pictureEdit1.Image == null)
            {
                return;
            }
            foreach (DataRow dataRow in (InternalDataCollectionBase)_mainTable.Rows)
            {
                try
                {
                    ((System.Drawing.Image)dataRow["Image"]).Dispose();
                }
                catch
                {
                }
            }
            _mainTable.Rows.Clear();
            Image    image = ((Bitmap)pictureEdit1.Image).ConvertFrom();
            FaceInfo face  = MainForm.Engine.DetectMaxFace(image, null);

            if (face != null)
            {
                foreach (BcIdentificationServer identificationServer in BcIdentificationServer.LoadAll())
                {
                    try
                    {
                        byte[]                     template                   = MainForm.Engine.ExtractTemplate(image, face);
                        BcServerSettings           bcServerSettings           = BcServerSettings.Load();
                        IdentificationServerClient identificationServerClient = new IdentificationServerClient(new InstanceContext(_client));
                        identificationServerClient.Endpoint.Address = new EndpointAddress("net.tcp://" + (object)bcServerSettings.Ip + ":" + (string)(object)bcServerSettings.Port + "/FaceIdentification/IdentificationServer");
                        identificationServerClient.Open();
                        List <Guid> list   = new List <Guid>();
                        long        dtFrom = 0;
                        if (this.dtFrom.Text != "")
                        {
                            dtFrom = this.dtFrom.DateTime.Date.Ticks;
                        }
                        long dtBefore = 0;
                        if (this.dtBefore.Text != "")
                        {
                            dtBefore = this.dtBefore.DateTime.Date.Ticks;
                        }
                        if (template != null)
                        {
                            identificationServerClient.DbSearch((int)spinEdit1.Value, Convert.ToSingle(tbScore.Text), dtFrom, dtBefore, cbSex.SelectedIndex, template);
                            _startDate = DateTime.Now;
                            marqueeProgressBarControl1.Visible = true;
                            _maintimer.Enabled = true;
                            break;
                        }
                        int num = (int)XtraMessageBox.Show(Messages.Error, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    catch (Exception ex)
                    {
                        int num = (int)XtraMessageBox.Show(ex.Message, Messages.IdentificationServerUnavailble, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                int num1 = (int)XtraMessageBox.Show(Messages.NoFaceWasFound, Messages.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }