public CopyButtonDialog(Settings settings, ButtonsForm buttons_form)
 {
     InitializeComponent();
     Icon = Properties.Resources.icon;
     this.buttons_form = buttons_form;
     this.settings     = settings;
 }
        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 #3
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;
        }