Example #1
0
        static void Main()
        {
            bool ok;
            Mutex m = new System.Threading.Mutex(true, "Smart Clicker", out ok);

            if (!ok)
            {
                return;
            }

            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClickStatus status = new ClickStatus();
            CustomizationParameters customParams = new XmlMethods().loadFromXML();
            MainForm mainForm = new MainForm(status, customParams);
            ClickDetector clickDetector = new ClickDetector(status, new CursorCapture(), customParams, mainForm);
            mainForm.detector = clickDetector;

            Application.ThreadException += new ThreadExceptionEventHandler(mainForm.CatchFatalException);

            Application.Run(mainForm);
            GC.KeepAlive(m);
        }
Example #2
0
 public ClickDetector(ClickStatus status, CursorCapture capture, CustomizationParameters parameters, MainForm form)
 {
     this.status = status;
     this.capture = capture;
     this.parameters = parameters;
     this.form = form;
     this.lastClick = new cursorInTime(-50, -50, null);
     InitTimer();
     this.automator = new CUIAutomation();
 }
Example #3
0
 //, CustomizationParameters parameters)
 public Fetcher(MainForm mainForm)
 {
     InitializeComponent();
     this.mainForm = mainForm;
     this.ShowInTaskbar = false;
     mainForm.Move += new EventHandler(move_On_Main_Form);
     this.StartPosition = FormStartPosition.Manual;
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.ControlBox = false;
     this.MinimumSize = new Size(10, 10);
     this.Size = new Size(25, 25);   //(parameters.clickValues.clickBoundingBox, parameters.clickValues.clickBoundingBox);
     this.Location = new Point(this.mainForm.Location.X, this.mainForm.Location.Y - this.Size.Height);
     this.TopMost = true;
 }
Example #4
0
        public CustomUI(CustomizationParameters customParams, MainForm mainForm)
        {
            InitializeComponent();
            this.customParams = customParams;
            this.changedParams = customParams.copy();
            this.mainform = mainForm;
            this.timerText.Text = (((double) changedParams.clickValues.timeout)/ 100).ToString();
            this.boundingBoxText.Text = changedParams.clickValues.clickBoundingBox.ToString();
            CheckBox[] modes = { displayClickDragMode, displayContextMode, displayDoubleMode, displayLeftMode, displayRightMode, displaySleepMode };
            CheckBox[] contextSettings = { contextCompareCursors, contextScrollBars, contextTabs, contextTitleBars };
            this.startupBoot.Checked = this.changedParams.layoutValues.startOnStartup;
            this.crashReboot.Checked = this.changedParams.layoutValues.restartOnCrash;
            contextCompareCursors.Checked = this.changedParams.contextValues.compareCursors;
            contextScrollBars.Checked = this.changedParams.contextValues.supportScrollBars;
            contextTabs.Checked = this.changedParams.contextValues.supportTabs;
            contextTitleBars.Checked = this.changedParams.contextValues.supportTitleBars;

            ModeToStringMapping = new Dictionary<CheckBox, string>()
            {
                {displayLeftMode, "leftClick"},
                {displayRightMode, "rightClick"},
                {displayDoubleMode, "doubleClick"},
                {displayContextMode, "contextClick"},
                {displayClickDragMode, "clickAndDrag"},
                {displaySleepMode, "sleepClick"},
                {displayHelp, "help"},
            };
            StringToModeMapping = new Dictionary<string,CheckBox>();
            foreach (CheckBox key in ModeToStringMapping.Keys)
            {
                StringToModeMapping.Add(this.ModeToStringMapping[key], key);
            }
            foreach (CheckBox box in modes)
            {
                box.Checked = true;
                box.CheckedChanged += new EventHandler(box_CheckedChanged);
            }
            foreach (string hidden in this.changedParams.layoutValues.hiddenIconNames.ToList<string>())
            {
                StringToModeMapping[hidden].Checked = false;
            }
        }