Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (pictureBox1.Image != null && FileNameText.Text != "")
     {
         NowFrame.Save(string.Format(FuncClass.Check_path($@"IDSCut\{DirText.Text}\") + "{0}.jpg", FileNameText.Text, System.Drawing.Imaging.ImageFormat.Png));
         MessageBox.Show("Save");
         FileNameText.Clear();
     }
 }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (pictureBox1.Image != null && FileNameText.Text != "")
     {
         BigShot.Save(string.Format(FuncClass.Check_path($@"ScreenCut\") + "{0}.jpg", FileNameText.Text, System.Drawing.Imaging.ImageFormat.Png));
         MessageBox.Show("Save");
     }
     else
     {
         MessageBox.Show("Please fill in the file name.");
     }
 }
Пример #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_recognizeRate.Text))
            {
                MessageBox.Show("Recognize reate can't be null");
                return;
            }
            List <string> ParameterList = new List <string>();

            ParameterList.Add(txt_scriptName.Text.Trim());
            ParameterList.Add(txt_ConfigName.Text.Trim());
            ParameterList.Add(txt_recognizeRate.Text.Trim());

            // Tool open automatically
            if (rbtn_yes.Checked)
            {
                ParameterList.Add("yes");
                FuncClass.AddTaskToScheduler($@"{Application.StartupPath}\HP_Display.exe", "", "HP_Display");
            }
            else if (rbtn_no.Checked)
            {
                ParameterList.Add("no");
                FuncClass.DeleteTaskFromScheduler("HP_Display");
            }

            using (StreamWriter sw = new StreamWriter(Application.StartupPath + @"\Config.txt"))
            {
                foreach (var item in ParameterList)
                {
                    sw.WriteLine(item);
                }
                sw.Close();
            }
            try
            {
                Parameters.Confidential = Convert.ToDouble(txt_recognizeRate.Text.Trim()) / 100;
            }
            catch (Exception)
            {
                Parameters.Confidential = 0.80;
            }
            this.Close();
        }
Пример #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (pictureBox2.Image != null && FileNameText.Text != "")
     {
         newRec.Save(string.Format(FuncClass.Check_path($@"IDSCut\{DirText.Text}\") + "{0}.jpg", FileNameText.Text, System.Drawing.Imaging.ImageFormat.Png));
         if (!Directory.Exists($@"IDSCut\{DirText.Text}"))
         {
             Directory.CreateDirectory($@"IDSCut\{DirText.Text}");
         }
         using (StreamWriter sw = new StreamWriter(FuncClass.Check_path($@"IDSCut\{DirText.Text}") + $"{FileNameText.Text}.txt"))
         {
             foreach (var item in CutRange)
             {
                 sw.WriteLine(item);
             }
             sw.Close();
         }
         pictureBox1.Refresh();
         MessageBox.Show("Save");
         FileNameText.Clear();
     }
 }
Пример #5
0
        private void TEST_Load(object sender, EventArgs e)
        {
            //Console.WriteLine(Screen.PrimaryScreen);

            string kfcs    = @"MONITOR\ACR0294\{4d36e96e-e325-11ce-bfc1-08002be10318}\0002";
            string fuckyou = FuncClass.StringCut(kfcs);

            //MessageBox.Show(fuckyou);
            foreach (var screen in System.Windows.Forms.Screen.AllScreens)
            {
                Console.WriteLine("Device Name: " + screen.DeviceName);              //裝置名稱
                Console.WriteLine("Bounds: " + screen.Bounds.ToString());            //螢幕解析度
                Console.WriteLine("Working Area: " + screen.WorkingArea.ToString()); //實際工作區域
            }

            /*
             * try
             * {
             *  ManagementObjectSearcher USB = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE service =\"monitor\"");
             *  ManagementObjectCollection USBinfo = USB.Get();
             *  string serialNumber = "";
             *  List<string> name = new List<string>();
             *  foreach (ManagementObject MO in USBinfo)
             *  {
             *      serialNumber = (string)MO["HardwareID"];
             *      name.Add((string)MO["Name"]);
             *      Console.WriteLine(serialNumber);
             *  }
             * }
             * catch (ManagementException ex)
             * {
             *  MessageBox.Show("An error occurred while querying for WMI data: " + ex.Message);
             * }
             */
            /*
             * ManagementObjectCollection collection;
             * using (var searcher = new ManagementObjectSearcher("Select * From Win32_PnPEntity WHERE service =\"monitor\""))
             *  collection = searcher.Get();
             * foreach (ManagementBaseObject device in collection)
             * {
             *  string[] vs = (string[])device.GetPropertyValue("HardwareID");
             *  foreach (var item in vs)
             *  {
             *      Console.WriteLine("56456"+item);
             *  }
             *  Console.WriteLine((string)device.GetPropertyValue("Availability"));
             *  Console.WriteLine((string)device.GetPropertyValue("PNPDeviceID"));
             *  Console.WriteLine((string)device.GetPropertyValue("Description"));
             *  //Console.WriteLine((string)device.GetPropertyValue("HardwareID[0]"));
             * }
             * collection.Dispose();
             */
            /*
             * var device = new DISPLAY_DEVICE();
             * device.cb = Marshal.SizeOf(device);
             * foreach (var screen in Screen.AllScreens)
             * {
             *  for (uint id = 0; EnumDisplayDevices(null, id, ref device, 0); id++)
             *  {
             *      device.cb = Marshal.SizeOf(device);
             *      EnumDisplayDevices(device.DeviceName, 0, ref device, 0);
             *      device.cb = Marshal.SizeOf(device);
             *
             *      Console.WriteLine("id={0}, name={1}, devicestring={2}", device.DeviceID, device.DeviceName, device.DeviceString);
             *      if (device.DeviceName == null || device.DeviceName == "") continue;
             *
             *      //if (screen.DeviceName.Contains("DISPLAY1") && device.DeviceName.Contains("DISPLAY1"))
             *      //{
             *      //    //idl.Add();
             *      //}
             *  }
             * }
             */
        }
Пример #6
0
 private void button7_Click(object sender, EventArgs e)
 {
     FuncClass.Input("USB-5856,BID#0", startPort, Rdata);
     textBox1.Text += Rdata + Environment.NewLine;
 }
Пример #7
0
 private void button6_Click(object sender, EventArgs e)
 {
     FuncClass.Output("0x14", "USB-5856,BID#0", portCount, startPort);
 }