示例#1
0
        /// <summary>
        /// Set up the helper service and check for extension installation and updates
        /// </summary>
        /// <param name="args"></param>
        public Program(String[] args)
        {
            // Only start if there isn't an instance already running
            _mainMenu = new ContextMenu();
            _mainMenu.MenuItems.Add("Donate", (sender, eargs) => OpenUrlInBrowser(DonateUrl));
            _mainMenu.MenuItems.Add("Check for Updates", (sender, eargs) => CheckVersion(true));
            _mainMenu.MenuItems.Add("Download Firefox Extension", (sender, eargs) => OpenUrlInBrowser(ChromeExtensionDownloadUrl));
            _mainMenu.MenuItems.Add("Settings", ShowSettings);
            _mainMenu.MenuItems.Add("Exit", ConfirmExitApplication);

            _trayIcon = new NotifyIcon
            {
                Text        = Resources.ApplicationName,
                Icon        = Resources.ApplicationIcon,
                ContextMenu = _mainMenu,
                Visible     = true
            };

            if (args.Length > 0)
            {
                var link = args[0].Contains("sdownload://") ? args[0].Substring(12) : args[0];
                StreamFactory.DownloadTrack(link, new IconReportProxy(_trayIcon), true);
            }

            // Asynchronously check for updates
            CheckVersion();

            // Check if Chrome extension installed
            ValidateChromeInstallation();
        }