Esempio n. 1
0
        public SteamKeyJ()
        {
            InitializeComponent();
            AssignDictionary();
            var kri = KeyRecogniser.Instance;

            KeyRecogniser.RequestedKeysPressed += new EventHandler(KeyRecogniser_RequestedKeysPressed);

            MenuItem miExit            = new MenuItem("Exit", (s, e) => { this.Close(); });
            MenuItem miShow            = new MenuItem("Open SteamKeyJ", (s, e) => { this.Show(); this.Visible = true; this.WindowState = FormWindowState.Normal; });
            MenuItem miToggleEnable    = new MenuItem((isHooked) ? "Disable" : "Enable", (s, e) => { checkBox1.Checked = !checkBox1.Checked; ((MenuItem)s).Text = (isHooked) ? "Disable" : "Enable"; });
            MenuItem miShowMusicPlayer = new MenuItem("Show Music Player", (s, e) => { Process.Start("steam://open/musicplayer"); });

            cMenu.MenuItems.Add(miToggleEnable);
            cMenu.MenuItems.Add(miShowMusicPlayer);
            cMenu.MenuItems.Add(miShow);
            cMenu.MenuItems.Add(miExit);

            notifyIcon1.ContextMenu  = cMenu;
            notifyIcon1.Text         = "SteamKeyJ";
            notifyIcon1.Icon         = new Icon("SKDJ.ico");
            notifyIcon1.DoubleClick += (s, e) => { this.Show(); this.Visible = true; this.WindowState = FormWindowState.Normal; };


            this.Closing += (s, e) =>
            {
                KeyRecogniser.Unhook();
            };

            //check if 'hidden' was passed in, start minimized
            if (Environment.GetCommandLineArgs().Contains("-hidden", StringComparer.OrdinalIgnoreCase))
            {
                this.WindowState = FormWindowState.Minimized;
            }
        }
Esempio n. 2
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox1.Checked)
     {
         KeyRecogniser.SetHook();
         isHooked = true;
     }
     else
     {
         KeyRecogniser.Unhook();
         isHooked = false;
     }
 }