public TrayBasedContext(Icon appIcon, KeyPressState kps, IConfigProvider optionProvider)
        {
            this.formLaunchShortcut = kps;
            this.optionProvider     = optionProvider;
            this.data = optionProvider.Load();
            this.EnsureRequiredOptions(data, optionProvider);
            launcher     = new UrlLauncher();
            controlState = new Dictionary <Keys, bool>();

            foreach (var k in GlobalKeyboardHook.ControlKeys)
            {
                controlState.Add(k, false);
            }

            var launch  = new MenuItem("Launch", Launch);
            var options = new MenuItem("Options", Options);
            var exit    = new MenuItem("Exit", Exit);

            MenuItem[] main = { launch, exit };

            // Initialize Tray Icon
            trayIcon = new NotifyIcon()
            {
                Icon        = appIcon,
                ContextMenu = new ContextMenu(main),
                Visible     = true
            };
        }
Beispiel #2
0
        public Launchpad(IUrlLauncher launcher, string urlFormat)
        {
            InitializeComponent();

            if (string.IsNullOrWhiteSpace(urlFormat))
            {
                this.Close();
            }

            UrlFormatChanged += Launchpad_UrlFormatChanged;
            this.launcher     = launcher;
            this.urlFormat    = urlFormat;
        }