Ejemplo n.º 1
0
        private void button_SaveConfig_Click(object sender, EventArgs e)
        {
            int x = 0, y = 0, width = 2, height = 2;

            try
            {
                x      = int.Parse(textBox_X.Text);
                y      = int.Parse(textBox_Y.Text);
                width  = int.Parse(textBox_Width.Text);
                height = int.Parse(textBox_Height.Text);
            }
            catch
            {
                MessageBox.Show("截图信息格式不正确,必须为数字");
                return;
            }

            Config.CutX           = x;
            Config.CutY           = y;
            Config.CutHeight      = height;
            Config.CutWidth       = width;
            Config.UseEmulator    = checkBox_PCScreen.Checked;
            Config.OCR_API_KEY    = textBox_API_KEY.Text;
            Config.OCR_SECRET_KEY = textBox_SECRET_KEY.Text;
            BaiDuOCR.InitBaiDuOCR(textBox_API_KEY.Text, textBox_SECRET_KEY.Text);
            Config.SaveConfig();
            MessageBox.Show("保存成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 2
0
        private void button_SaveConfig_Click(object sender, EventArgs e)
        {
            int x = 0, y = 0, width = 2, height = 2;

            try
            {
                x      = int.Parse(textBox_X.Text);
                y      = int.Parse(textBox_Y.Text);
                width  = int.Parse(textBox_Width.Text);
                height = int.Parse(textBox_Height.Text);
            }
            catch
            {
                MessageBox.Show("截图信息格式不正确,必须为数字");
                return;
            }

            Config.CutX              = x;
            Config.CutY              = y;
            Config.CutHeight         = height;
            Config.CutWidth          = width;
            Config.UseEmulator       = checkBox_PCScreen.Checked;
            Config.RemoveUselessInfo = checkBox_RemoveUselessInfo.Checked;
            Config.ShowABC           = checkBox_ShowABC.Checked;
            Config.UseSoGou          = checkBox_UseSoGou.Checked;
            Config.OCR_API_KEY       = textBox_API_KEY.Text;
            Config.OCR_SECRET_KEY    = textBox_SECRET_KEY.Text;
            Config.OCREnhance        = checkBox_Enhance.Checked;
            BaiDuOCR.InitBaiDuOCR(textBox_API_KEY.Text, textBox_SECRET_KEY.Text);

            if (radioButton_NoHighLighting.Checked)
            {
                Config.HighlightMode = HLMode.NoHighLighting;
            }
            else if (radioButton_Compatible.Checked)
            {
                Config.HighlightMode = HLMode.Compatible;
            }
            else
            {
                Config.HighlightMode = HLMode.Fast;
            }

            Config.SaveConfig();
            MessageBox.Show("保存成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //便于并发请求同时进行
            ServicePointManager.MaxServicePoints                  = 512;
            ServicePointManager.DefaultConnectionLimit            = 512;
            System.Net.ServicePointManager.DefaultConnectionLimit = 64;

            //禁用跨线程UI操作检查
            Control.CheckForIllegalCrossThreadCalls = false;

            Config.LoadConfig();

            BaiDuOCR.InitBaiDuOCR(Config.OCR_API_KEY, Config.OCR_SECRET_KEY);

            browserForm = new BrowserForm();
            browserForm.Show();
            MainForm_Move(null, null);

            HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.None, Keys.F7);
        }