Example #1
0
        //when the save button is clicked
        private void saveButton_Click(object sender, EventArgs e)
        {
            ControlState.SetSystemEnabled(enableControlCheck.Checked);

            ControlState.SetControllerEnabled(0, controller0CheckBox.Checked);
            ControlState.SetControllerEnabled(1, controller1CheckBox.Checked);
            ControlState.SetControllerEnabled(2, controller2CheckBox.Checked);
            ControlState.SetControllerEnabled(3, controller3CheckBox.Checked);

            Close();
        }
        //constructor for the main application
        public XMouseService()
        {
            // Create a simple tray menu with only one item.
            _menu = new ContextMenu();

            //create the settings item
            MenuItem settingsMenu = new MenuItem("Settings", _icon_Click);

            _menu.MenuItems.Add(settingsMenu);

            //add the break
            _menu.MenuItems.Add(new MenuItem("-"));

            //exit option is last
            MenuItem exitMenu = new MenuItem("Exit", Quit);

            _menu.MenuItems.Add(exitMenu);

            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.
            _icon      = new NotifyIcon();
            _icon.Text = "XMouse";

            // Add menu to tray icon and show it.
            _icon.ContextMenu = _menu;
            _icon.Visible     = true;



            ControlState.SetSystemEnabled(true);
            ControlState.SetControllerEnabled(0, true);


            _icon.Click += new EventHandler(_icon_Click);
        }