Вячеслав Терешенко před 2 roky
rodič
revize
d060863aa3

+ 37 - 28
T FaceRecognizer/FormMain.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
             this.PbxFaces = new System.Windows.Forms.PictureBox();
@@ -66,6 +67,8 @@
             this.BtnOut = new System.Windows.Forms.Button();
             this.PbxIdentification = new System.Windows.Forms.PictureBox();
             this.tabPage3 = new System.Windows.Forms.TabPage();
+            this.label11 = new System.Windows.Forms.Label();
+            this.TbxSearch = new System.Windows.Forms.TextBox();
             this.DgbJournal = new System.Windows.Forms.DataGridView();
             this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -86,8 +89,7 @@
             this.LblTitle = new System.Windows.Forms.Label();
             this.PbxLogo = new System.Windows.Forms.PictureBox();
             this.SplitContainer = new System.Windows.Forms.SplitContainer();
-            this.TbxSearch = new System.Windows.Forms.TextBox();
-            this.label11 = new System.Windows.Forms.Label();
+            this.TimerCamsControl = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.PbxFaces)).BeginInit();
             this.PanelMenu.SuspendLayout();
             this.PanSettings.SuspendLayout();
@@ -520,7 +522,7 @@
             this.BtnIn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.BtnIn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(166)))), ((int)(((byte)(64)))));
             this.BtnIn.ForeColor = System.Drawing.Color.White;
-            this.BtnIn.Location = new System.Drawing.Point(235, 308);
+            this.BtnIn.Location = new System.Drawing.Point(235, 300);
             this.BtnIn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.BtnIn.Name = "BtnIn";
             this.BtnIn.Size = new System.Drawing.Size(190, 37);
@@ -534,7 +536,7 @@
             this.BtnOut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
             this.BtnOut.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(58)))), ((int)(((byte)(166)))), ((int)(((byte)(64)))));
             this.BtnOut.ForeColor = System.Drawing.Color.White;
-            this.BtnOut.Location = new System.Drawing.Point(8, 308);
+            this.BtnOut.Location = new System.Drawing.Point(8, 300);
             this.BtnOut.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.BtnOut.Name = "BtnOut";
             this.BtnOut.Size = new System.Drawing.Size(190, 37);
@@ -552,7 +554,7 @@
             this.PbxIdentification.Location = new System.Drawing.Point(4, 5);
             this.PbxIdentification.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.PbxIdentification.Name = "PbxIdentification";
-            this.PbxIdentification.Size = new System.Drawing.Size(421, 293);
+            this.PbxIdentification.Size = new System.Drawing.Size(421, 285);
             this.PbxIdentification.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.PbxIdentification.TabIndex = 1;
             this.PbxIdentification.TabStop = false;
@@ -562,13 +564,32 @@
             this.tabPage3.Controls.Add(this.label11);
             this.tabPage3.Controls.Add(this.TbxSearch);
             this.tabPage3.Controls.Add(this.DgbJournal);
-            this.tabPage3.Location = new System.Drawing.Point(4, 30);
+            this.tabPage3.Location = new System.Drawing.Point(4, 22);
             this.tabPage3.Name = "tabPage3";
-            this.tabPage3.Size = new System.Drawing.Size(429, 355);
+            this.tabPage3.Size = new System.Drawing.Size(429, 363);
             this.tabPage3.TabIndex = 2;
             this.tabPage3.Text = "Journal";
             this.tabPage3.UseVisualStyleBackColor = true;
             // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Location = new System.Drawing.Point(4, 8);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(129, 21);
+            this.label11.TabIndex = 2;
+            this.label11.Text = "Поиск по ФИО: ";
+            // 
+            // TbxSearch
+            // 
+            this.TbxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.TbxSearch.Location = new System.Drawing.Point(139, 5);
+            this.TbxSearch.Name = "TbxSearch";
+            this.TbxSearch.Size = new System.Drawing.Size(282, 29);
+            this.TbxSearch.TabIndex = 1;
+            this.TbxSearch.TextChanged += new System.EventHandler(this.TbxSearch_TextChanged);
+            // 
             // DgbJournal
             // 
             this.DgbJournal.AllowUserToAddRows = false;
@@ -595,7 +616,7 @@
             this.DgbJournal.RowTemplate.DividerHeight = 5;
             this.DgbJournal.RowTemplate.Height = 35;
             this.DgbJournal.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
-            this.DgbJournal.Size = new System.Drawing.Size(423, 304);
+            this.DgbJournal.Size = new System.Drawing.Size(423, 296);
             this.DgbJournal.TabIndex = 0;
             this.DgbJournal.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgbJournal_CellDoubleClick);
             // 
@@ -628,9 +649,9 @@
             this.tabPage4.Controls.Add(this.CbxSaveLocationForm);
             this.tabPage4.Controls.Add(this.CmbCams);
             this.tabPage4.Controls.Add(this.label7);
-            this.tabPage4.Location = new System.Drawing.Point(4, 30);
+            this.tabPage4.Location = new System.Drawing.Point(4, 22);
             this.tabPage4.Name = "tabPage4";
-            this.tabPage4.Size = new System.Drawing.Size(429, 355);
+            this.tabPage4.Size = new System.Drawing.Size(429, 363);
             this.tabPage4.TabIndex = 3;
             this.tabPage4.Text = "Settings";
             this.tabPage4.UseVisualStyleBackColor = true;
@@ -692,9 +713,9 @@
             // 
             this.tabPage5.Controls.Add(this.GbxInfo);
             this.tabPage5.Controls.Add(this.PanelTitle);
-            this.tabPage5.Location = new System.Drawing.Point(4, 30);
+            this.tabPage5.Location = new System.Drawing.Point(4, 22);
             this.tabPage5.Name = "tabPage5";
-            this.tabPage5.Size = new System.Drawing.Size(429, 355);
+            this.tabPage5.Size = new System.Drawing.Size(429, 363);
             this.tabPage5.TabIndex = 4;
             this.tabPage5.Text = "Main";
             this.tabPage5.UseVisualStyleBackColor = true;
@@ -806,22 +827,10 @@
             this.SplitContainer.SplitterDistance = 248;
             this.SplitContainer.TabIndex = 5;
             // 
-            // TbxSearch
-            // 
-            this.TbxSearch.Location = new System.Drawing.Point(139, 5);
-            this.TbxSearch.Name = "TbxSearch";
-            this.TbxSearch.Size = new System.Drawing.Size(282, 29);
-            this.TbxSearch.TabIndex = 1;
-            this.TbxSearch.TextChanged += new System.EventHandler(this.TbxSearch_TextChanged);
-            // 
-            // label11
+            // TimerCamsControl
             // 
-            this.label11.AutoSize = true;
-            this.label11.Location = new System.Drawing.Point(4, 8);
-            this.label11.Name = "label11";
-            this.label11.Size = new System.Drawing.Size(129, 21);
-            this.label11.TabIndex = 2;
-            this.label11.Text = "Поиск по ФИО: ";
+            this.TimerCamsControl.Enabled = true;
+            this.TimerCamsControl.Tick += new System.EventHandler(this.TimerCamsControl_Tick);
             // 
             // FormMain
             // 
@@ -840,7 +849,6 @@
             this.Text = "FaceTrack профессиональный";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
             this.Load += new System.EventHandler(this.FormMain_Load);
-            this.ResizeEnd += new System.EventHandler(this.FormMain_ResizeEnd);
             this.Resize += new System.EventHandler(this.FormMain_Resize);
             ((System.ComponentModel.ISupportInitialize)(this.PbxFaces)).EndInit();
             this.PanelMenu.ResumeLayout(false);
@@ -937,6 +945,7 @@
         private System.Windows.Forms.Label label6;
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.TextBox TbxSearch;
+        private System.Windows.Forms.Timer TimerCamsControl;
     }
 }
 

+ 36 - 9
T FaceRecognizer/FormMain.cs

@@ -233,7 +233,7 @@ namespace T_FaceRecognizer
             //ProgressOperation.Value = 10;
             //TslStatus.Text = "Добавление нового пользователя...";
 
-            bool Flag = TbxLastname.Text.Trim() == "" || TbxName.Text.Trim() == "" || TbxMaskPhone.Text.Trim() == "" || TbxMaskSnils.Text.Trim() == "";
+            bool Flag = TbxLastname.Text.Trim() == "" || TbxName.Text.Trim() == "" || TbxMaskPhone.Text.Trim() == "" || TbxMaskSnils.Text.Trim().Replace(" ","").Length < 11;
 
             if (Flag)
             {
@@ -374,11 +374,6 @@ values (@last,@first,@patr,@phone,@snils,@photo)
             ControlSizeMenu(IsMenuOpened);
         }
 
-        private void FormMain_ResizeEnd(object sender, EventArgs e)
-        {
-            //PbxMenu_Click(sender, e);
-        }
-
         private void BtnMain_Click(object sender, EventArgs e)
         {
             Task.Factory.StartNew(() =>
@@ -408,7 +403,6 @@ values (@last,@first,@patr,@phone,@snils,@photo)
             Capture.SetCaptureProperty(CapProp.FrameHeight, 450);
             Capture.SetCaptureProperty(CapProp.FrameWidth, 370);
             CaptureTimer.Start();
-
         }
 
         private void BtnIdent_Click(object sender, EventArgs e)
@@ -680,7 +674,14 @@ from Users
                 string DateTemplate = string.Empty;
                 while(Res.Read())
                 {
-                    DateTemplate = DateTime.Parse(Res["LastDateVisit"].ToString()).ToString("dd.MM.yyyy");
+                    try
+                    {
+                        DateTemplate = DateTime.Parse(Res["LastDateVisit"].ToString()).ToString("dd.MM.yyyy");
+                    }
+                    catch(Exception ex)
+                    {
+                        DateTemplate = "нет";
+                    }
 
                     DgbJournal.Rows.Add(Res["UserID"].ToString(), Res["FIO"].ToString(), DateTemplate);
                 }
@@ -740,7 +741,28 @@ from Users
                 CmbCams.SelectedIndex = SelectedCameraID;
             }
         }
-
+        /// <summary>
+        /// обработка ситуации изменения количества подключённых камер
+        /// </summary>
+        private void CamsPreview()
+        {
+            DsDevice[] Cams = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
+            int CountCams = Cams.Length;
+            if(CountCams != HtBefore.Count)
+            {
+                GetCams();
+                RecognizeOff();
+                if (TabPages.SelectedIndex == 0)
+                {
+                    BtnAddUser_Click(null, null);
+                }
+                else if (TabPages.SelectedIndex == 1)
+                {
+                    BtnIdent_Click(null, null);
+                }
+                Application.Restart();
+            }
+        }
         private void PanelMenu_Paint(object sender, PaintEventArgs e)
         {
             Invalidate();
@@ -847,5 +869,10 @@ from Users
         {
             GetInformationAboutVisiting();
         }
+
+        private void TimerCamsControl_Tick(object sender, EventArgs e)
+        {
+            CamsPreview();
+        }
     }
 }

+ 3 - 0
T FaceRecognizer/FormMain.resx

@@ -126,6 +126,9 @@
   <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="TimerCamsControl.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

+ 0 - 1
T FaceRecognizer/FormVisiting.cs

@@ -51,7 +51,6 @@ where UsersID = '{UserID}'
             SqlDataReader Res = Cmd.ExecuteReader();
             if(!Res.HasRows)
             {
-                MessageBox.Show("При выбранных параметрых сортировки посещения отсутствуют!", "FaceTrack", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 SCon.Close();
                 return;
             }

+ 0 - 0
T FaceRecognizer/bin/Debug/Source/FaceList.txt


binární
T FaceRecognizer/bin/Debug/Source/Faces/face1.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/face2.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/face3.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/face4.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/Алекс45896748596.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/Вячеслав12345678985.bmp


binární
T FaceRecognizer/bin/Debug/Source/Faces/Вячеслав74859619567.bmp


binární
T FaceRecognizer/bin/Debug/Source/T FaceRecognizer.exe


binární
T FaceRecognizer/bin/Debug/T FaceRecognizer.exe