public void SetUp()
        {
            this.shortcutsMananger = new ShortcutsManager();

            this.shortcut = new NiceShortcut();
            this.shortcut.Name = "Winamp";
            this.shortcut.Command = "Winamp";
            this.shortcut.KeyCode = System.Windows.Forms.Keys.W;
            this.shortcut.Control = true;
        }
Exemplo n.º 2
0
        private void RegisteShortcut(NiceShortcut shortcut, Form form)
        {
            shortcut.Pressed += delegate
            {
                try
                {
                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName = shortcut.Command;
                    Process.Start(startInfo);
                }
                catch(Exception ex)
                {
                    ShortcutsManager.ShowError(string.Format("Whoops, fail to execute command '{0}'.\n {1}",
                        shortcut.Command, ex.Message));
                }
            };

            if (shortcut.GetCanRegister(form))
                    shortcut.Register(form);
            else
                ShortcutsManager.ShowError("Whoops, looks like attempts to register will fail or throw an exception, show an error/visual user feedback");
        }
Exemplo n.º 3
0
 public void UnregisterShortcut(NiceShortcut shortcut)
 {
     if (shortcut.Registered)
         shortcut.Unregister();
 }
Exemplo n.º 4
0
 public void SetUp()
 {
     this.shortcut = new NiceShortcut();
 }