コード例 #1
0
ファイル: Main.cs プロジェクト: summarine/Gmail-Notifier-Plus
        /// <summary>
        /// Initializes the jumplist with the default set of items.
        /// </summary>
        private void InitJumpList()
        {
            int defaultAccountIndex = _config.Accounts.IndexOf(_config.Accounts.Default);

            String exePath      = Application.ExecutablePath;
            String iconsPath    = Path.Combine(Path.GetDirectoryName(exePath), "Resources\\Icons");
            String browserPath  = UrlHelper.GetDefaultBrowserPath();
            String url          = UrlHelper.BuildInboxUrl(defaultAccountIndex);
            String categoryName = Locale.Current.JumpList.DefaultAccount;

            _jumpList.ClearTasks();

            _jumpList.JumpItems.Add(new JumpTask()
            {
                ApplicationPath   = String.IsNullOrEmpty(browserPath) ? url : browserPath,
                Arguments         = String.IsNullOrEmpty(browserPath) ? String.Empty : url,
                IconResourceIndex = 0,
                IconResourcePath  = Path.Combine(iconsPath, "GoInbox.ico"),                // there's a really whacky conflict between an embedded resource, and a content resource file name.
                Title             = Locale.Current.JumpList.Inbox,
                CustomCategory    = categoryName
            });

            url = UrlHelper.BuildComposeUrl(defaultAccountIndex);

            _jumpList.JumpItems.Add(new JumpTask()
            {
                ApplicationPath   = String.IsNullOrEmpty(browserPath) ? url : browserPath,
                Arguments         = String.IsNullOrEmpty(browserPath) ? String.Empty : url,
                IconResourceIndex = 0,
                IconResourcePath  = Path.Combine(iconsPath, "Compose.ico"),
                Title             = Locale.Current.JumpList.Compose,
                CustomCategory    = categoryName
            });

            // general tasks

            Shellscape.UI.JumplistTask check    = new Shellscape.UI.JumplistTask("-check", Locale.Current.JumpList.Check, "Refresh.ico");
            Shellscape.UI.JumplistTask settings = new Shellscape.UI.JumplistTask("-settings", Locale.Current.JumpList.Preferences, "Settings.ico");
            Shellscape.UI.JumplistTask help     = new Shellscape.UI.JumplistTask("-help", Locale.Current.JumpList.Help, "help.ico");
            Shellscape.UI.JumplistTask about    = new Shellscape.UI.JumplistTask("-about", Locale.Current.JumpList.About, "about.ico");
            Shellscape.UI.JumplistTask donate   = new Shellscape.UI.JumplistTask("-donate", Locale.Current.About.Donate, "donate-paypal.ico");

            check.Click    += Jumplist_CheckMail;
            settings.Click += Jumplist_ShowPreferences;
            help.Click     += Jumplist_ShowHelp;
            about.Click    += Jumplist_ShowAbout;
            donate.Click   += LaunchDonation;

            _jumpList.JumpItems.AddRange(new List <JumpItem>()
            {
                check, settings, help, about, donate
            });

            _jumpList.Apply();

            InitTrayList(defaultAccountIndex);
        }