Example #1
0
        public MainForm()
        {
            InitializeComponent();

            //check which devices are available

            if (!MysticLightSDK.IsAvailable(true))
            {
                tabControl.TabPages.RemoveByKey("pageMysticLight");
            }

            if (!LogitechGSDK.IsAvailable(true))
            {
                tabControl.TabPages.RemoveByKey("pageLogitechG");
            }

            //preparing images

            bmpRaw  = new Bitmap((int)Math.Round((int)NumBoxScale.Value * RATIO), (int)NumBoxScale.Value, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            bmpProc = new Bitmap((int)Math.Round((int)NumBoxScale.Value * RATIO), (int)NumBoxScale.Value, System.Drawing.Imaging.PixelFormat.Format1bppIndexed);

            //preparing background thread for image processing

            mainLoop.WorkerSupportsCancellation = true;
            mainLoop.DoWork             += new DoWorkEventHandler(MainLoop);
            mainLoop.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MainLoopCompleted);

            //preparing necessary hooks

            Hook.GlobalEvents().MouseDown += async(sender, e) =>
            {
                Console.WriteLine($"Mouse {e.Button} Down");
            };
        }
Example #2
0
        private void BtnStart_Click(object sender, EventArgs e)
        {
            if (!mainLoop.IsBusy)
            {
                //code actually works with these enabled, but I'm being safe
                NumBoxX.Enabled     = false;
                NumBoxY.Enabled     = false;
                NumBoxScale.Enabled = false;
                ComboRes.Enabled    = false;

                if (MysticLightSDK.IsAvailable())
                {
                    MysticLightSDK.Init(false);
                }

                if (LogitechGSDK.IsAvailable())
                {
                    LogitechGSDK.Init(false);
                }

                LightsOff();

                mainLoop.RunWorkerAsync();
                StatusLabel.Text = "0";
                //StatusLabel.Text = "Scanning...";
            }
        }