static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            buttons_form = new ButtonsForm();

            Hook_target    target;
            VirtualKeyCode virtualKey;

            (presets, target, virtualKey) = Saver.load_settings();
            default_preset = presets.Where(x => x.name == default_preset_name).Single();

            mouseOrKeyboardHook = new MouseOrKeyboardHook(target, virtualKey, buttons_form.on_form_show, buttons_form.on_form_hide, false);
            settings            = new Settings(presets, buttons_form, mouseOrKeyboardHook);

            if (args.Length > 0)
            {
                if (args[0] == "add")
                {
                    settings.add_to_task_scheduler();
                }
                else if (args[0] == "del")
                {
                    settings.delete_from_task_scheduler();
                }
                settings.update_ToolStripMenuItem();
            }

            Application.Run();
        }
Beispiel #2
0
        public ActionButtonDialog(MouseOrKeyboardHook hook)
        {
            InitializeComponent();
            Icon      = Properties.Resources.icon;
            this.hook = hook;
            MouseButtonsComboBox.Items.AddRange(new object[] { mmb, mb4, mb5 });

            if (hook.hook_target == Hook_target.Keyboard)
            {
                MouseradioButton.Checked     = false;
                KeyboardradioButton.Checked  = true;
                MouseButtonsComboBox.Visible = false;
                ScanKeyTextBox.Visible       = true;
                ScanKeyTextBox.Text          = vk_to_appropriate_string(hook.action_button_keyboard);
            }
            else if (hook.hook_target == Hook_target.Mouse)
            {
                MouseradioButton.Checked          = true;
                KeyboardradioButton.Checked       = false;
                MouseButtonsComboBox.Visible      = true;
                ScanKeyTextBox.Visible            = false;
                MouseButtonsComboBox.SelectedItem = vk_to_appropriate_string(hook.action_button_mouse);
            }
            MouseradioButton.CheckedChanged           += MouseradioButton_CheckedChanged;
            MouseButtonsComboBox.SelectedIndexChanged += MouseButtonsComboBox_SelectedIndexChanged;
            foreach (Control item in Controls)
            {
                item.TabStop = false;
            }
            ignore_message = true;
            LShift         = MapVirtualKey((int)(Keys.LShiftKey), 0);
            RShift         = MapVirtualKey((int)(Keys.RShiftKey), 0);
            Ctrl           = MapVirtualKey((int)(Keys.ControlKey), 0);
            Alt            = MapVirtualKey((int)(Keys.Menu), 0);
        }
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         Cursor     = hand_cursor;
         mouse_hook = new MouseOrKeyboardHook(Hook_target.Mouse, WindowsInput.Native.VirtualKeyCode.LBUTTON,
                                              () => { }, get_window_handle, true);
     }
 }
Beispiel #4
0
        public Settings(List <Preset> presets, ButtonsForm buttons_form, MouseOrKeyboardHook hook)
        {
            InitializeComponent();
            Icon                       = Properties.Resources.icon;
            actionButtonForm           = new ActionButtonDialog(hook);
            presetName                 = new PresetNameDialog(presets);
            bindProcess                = new BindProcessDialog();
            copyButtonDialog           = new CopyButtonDialog(this, buttons_form);
            this.presets               = presets;
            this.buttons_form          = buttons_form;
            current_preset             = Program.default_preset;
            RenamePresetButton.Enabled = false;
            DeletePresetButton.Enabled = false;
            BindPresetButton.Enabled   = false;

            foreach (var item in presets)
            {
                PresetComboBox.Items.Add(item.name);
            }

            PresetComboBox.SelectedItem          = current_preset.name;
            PresetComboBox.SelectedIndexChanged += PresetComboBox_SelectedIndexChanged;

            Panel.Width  = buttons_form.Width;
            Panel.Height = buttons_form.Height;
            Point point = new Point(0, 0);

            point.X += Panel.Width / 2;
            point.Y += Panel.Height / 2;
            CursorpictureBox.Location = point;

            Editpanel.Enabled = false;
            update_ApplyAllCancelAllpanel(false);
            update_ApplyCancelpanel(false);

            update_ToolStripMenuItem();

            foreach (var item in Enum.GetNames(typeof(Action_type)))
            {
                Action_typeBox.Items.Add(item);
            }

            foreach (CustomButton button in current_preset.buttons)
            {
                add_button_to_panel(button.Clone());
            }

            currentButton   = null;
            previousbuttons = new List <CustomButton>();
            previousbuttons.Add(currentButton);
            apply_counter = 0;
        }