コード例 #1
0
ファイル: Form1.cs プロジェクト: JunKaiJuang/ProjectBackUp
        /// <summary>
        /// 控制項狀態更新
        /// </summary>
        private void RefreshControl()
        {
            _byPhoto.Enabled            = _view.EnableByPhoto();
            _byCam.Enabled              = _view.EnableByCam();
            _Borwse.Enabled             = _view.EnableBrowse();
            _continuedOrCapture.Enabled = _view.StopCapture();
            _trainButton.Enabled        = !_isTraining;
            _userNameLabel.Text         = "";

            //Save Face
            _saveFaceButton.Enabled  = _faceService.IsFaceDetected();
            _usernameTextBox.Enabled = _faceService.IsFaceDetected();
            //username list
            _userNameListBox.DataSource = _faceService.GetAllUsernames();
            //user faces group
            try
            {
                _facesListBox.DataSource = _faceService.GetFacesByUserName(_userNameListBox.SelectedItem.ToString());
                facesGroupBox.Enabled    = true;
            }
            catch (Exception)
            {
                _facesListBox.DataSource = null;
                facesGroupBox.Enabled    = false;
                //MessageBox.Show(e.Message);
            }

            //Capture State
            refreshCaptureState();
        }