Пример #1
0
        public ConfigForm(ClipboardImageOCR imageOCR)
        {
            InitializeComponent();
            this._clipboardImageOCR  = imageOCR;
            _modifiedConfiguration   = _clipboardImageOCR.GetCurrentConfiguration();
            textBox_AppID.Text       = _modifiedConfiguration.Baidu_ocr_APP_ID;
            textBox_APIKey.Text      = _modifiedConfiguration.Baidu_ocr_API_KEY;
            textBox_SecretKey.Text   = _modifiedConfiguration.Baidu_ocr_SECRET_KEY;
            checkAutoStartup.Checked = AutoStartup.Check();

            radioButton_Precision_False.Checked = !_modifiedConfiguration.Baidu_ocr_Precision;
            radioButton_Precision_True.Checked  = _modifiedConfiguration.Baidu_ocr_Precision;

            radioButton_cursorInput.Checked = _modifiedConfiguration.inputmode;
            radioButton_Clipboard.Checked   = !_modifiedConfiguration.inputmode;

            textBox_Max_image_Width.Text  = _modifiedConfiguration.Max_image_Width.ToString();
            textBox_Min_image_Width.Text  = _modifiedConfiguration.Min_image_Width.ToString();
            textBox_Max_image_Height.Text = _modifiedConfiguration.Max_image_Height.ToString();
            textBox_Min_image_Height.Text = _modifiedConfiguration.Min_image_Height.ToString();

            HotKey        = _modifiedConfiguration.HotKey;
            textBox4.Text = getKeyEventArgsString(_modifiedConfiguration.HotKey);

            radioButtonEnter.Checked = _modifiedConfiguration.autoAddEnter;
            radioButtonTab.Checked   = _modifiedConfiguration.autoAddTab;
            if (_modifiedConfiguration.autoAddEnter == false && _modifiedConfiguration.autoAddTab == false)
            {
                radioButtonN.Checked = true;
            }
        }
Пример #2
0
        //确定
        private void button1_Click(object sender, EventArgs e)
        {
            _modifiedConfiguration.autoBan              = checkAutoStartup.Checked;
            _modifiedConfiguration.Baidu_ocr_APP_ID     = textBox_AppID.Text;
            _modifiedConfiguration.Baidu_ocr_API_KEY    = textBox_APIKey.Text;
            _modifiedConfiguration.Baidu_ocr_SECRET_KEY = textBox_SecretKey.Text;
            _modifiedConfiguration.Baidu_ocr_Precision  = !radioButton_Precision_False.Checked;


            if (checkAutoStartup.Checked != AutoStartup.Check() && !AutoStartup.Set(checkAutoStartup.Checked))
            {
                MessageBox.Show("开机自启动,无法更新注册表");
            }

            if (radioButton_cursorInput.Checked)
            {
                _modifiedConfiguration.inputmode = true;
            }
            else
            {
                _modifiedConfiguration.inputmode = false;
            }


            _modifiedConfiguration.Max_image_Width  = Convert.ToInt32(textBox_Max_image_Width.Text);
            _modifiedConfiguration.Min_image_Width  = Convert.ToInt32(textBox_Min_image_Width.Text);
            _modifiedConfiguration.Max_image_Height = Convert.ToInt32(textBox_Max_image_Height.Text);
            _modifiedConfiguration.Min_image_Height = Convert.ToInt32(textBox_Min_image_Height.Text);

            _modifiedConfiguration.HotKey = HotKey;

            _modifiedConfiguration.autoAddEnter = radioButtonEnter.Checked;
            _modifiedConfiguration.autoAddTab   = radioButtonTab.Checked;

            _clipboardImageOCR.SaveServersConfig(_modifiedConfiguration);

            this.Close();
        }