Exemplo n.º 1
0
        private void _Notifier_CheckFinished(Notifier sender, EventArgs e)
        {
            if (_StatusList.ContainsKey(sender.Text)) {
                _StatusList[sender.Text] = sender.ConnectionStatus;
            }
            else {
                _StatusList.Add(sender.Text, sender.ConnectionStatus);
            }

            _UnreadTotal += sender.Unread;

            FinalizeChecks();
        }
Exemplo n.º 2
0
		private void CreateInstances() {

			for(int i = 0; i < _config.Accounts.Count; i++) {

				Account account = _config.Accounts[i];

				if(_instances.ContainsKey(account.Guid)) {
					continue;
				}

				Notifier notifier = new Notifier(account);
				notifier.FormClosed += _Notifier_FormClosed;
				notifier.CheckMailFinished += _Notifier_CheckFinished;

				_instances.Add(account.Guid, notifier);

				notifier.Show(this);

				TabbedThumbnail preview = new TabbedThumbnail(base.Handle, notifier.Handle);
				preview.TabbedThumbnailClosed += _Preview_TabbedThumbnailClosed;
				preview.SetWindowIcon(Resources.Icons.Window);
				preview.Tooltip = String.Empty;
				preview.Title = account.FullAddress;

				notifier.PreviewThumbnail = preview;

				_taskbarManager.TabbedThumbnail.AddThumbnailPreview(preview);
			}

			if(_config.Accounts.Count > 0) {
				Account account = _config.Accounts[0];
				_taskbarManager.TabbedThumbnail.SetActiveTab(_instances[account.Guid].Handle);
			}
		}
Exemplo n.º 3
0
        private void CreateInstances()
        {
            for (int i = 0; i < _Config.Accounts.Count; i++) {

                Account account = _Config.Accounts[i];

                if (_Instances.ContainsKey(account.FullAddress)) {
                    continue;
                }

                Notifier notifier = new Notifier(i);
                notifier.FormClosed += _Notifier_FormClosed;
                notifier.CheckMailFinished += _Notifier_CheckFinished;

                _Instances.Add(account.FullAddress, notifier);

                notifier.Show(this);

                TabbedThumbnail preview = new TabbedThumbnail(base.Handle, notifier.Handle);
                preview.TabbedThumbnailClosed += _Preview_TabbedThumbnailClosed;
                preview.SetWindowIcon(Utilities.ResourceHelper.GetIcon("gmail-classic.ico"));
                preview.Tooltip = String.Empty;
                preview.Title = account.FullAddress;

                _TaskbarManager.TabbedThumbnail.AddThumbnailPreview(preview);

            }

            if (_Config.Accounts.Count > 0) {
                Account account = _Config.Accounts[0];
                _TaskbarManager.TabbedThumbnail.SetActiveTab(_Instances[account.FullAddress].Handle);
            }
        }
Exemplo n.º 4
0
        private void UpdateMailsJumpList()
        {
            if (!_config.RecentDocsTracked)
            {
                return;
            }

            _jumpList.RemoveCustomCategories();

            Dictionary <string, List <JumpListLink> > dictionary = new Dictionary <string, List <JumpListLink> >();

            int i           = 0;
            int unreadCount = Math.Min(_UnreadTotal, (int)_jumpList.MaxSlotsInList);
            int index       = 0;
            int mailCount   = 0;

            while (i < unreadCount)
            {
                String linkText;

                Notifier notifier = _instances[_config.Accounts[index].Guid];
                Account  account  = notifier.Account;

                if (Locale.Current.IsRightToLeftLanguage)
                {
                    linkText = String.Concat("(", notifier.Unread, ") ", account.FullAddress, " ");
                }
                else
                {
                    linkText = String.Concat(account.FullAddress, " (", notifier.Unread, ")");
                }

                if (!dictionary.ContainsKey(linkText))
                {
                    dictionary.Add(linkText, new List <JumpListLink>());
                }

                if (mailCount < notifier.Emails.Count)
                {
                    Email  email = notifier.Emails[mailCount];
                    String path  = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\Icons");

                    JumpListLink item = new JumpListLink(email.Url, email.Title)
                    {
                        IconReference = new IconReference(Path.Combine(path, "Mail.ico"), 0)
                    };

                    dictionary[linkText].Add(item);
                    i++;
                }

                if (index < (_instances.Count - 1))
                {
                    index++;
                }
                else
                {
                    index = 0;
                    mailCount++;
                }
            }

            foreach (KeyValuePair <string, List <JumpListLink> > pair in dictionary)
            {
                JumpListCustomCategory category = new JumpListCustomCategory(pair.Key);
                category.AddJumpListItems(pair.Value.ToArray());

                _jumpList.AddCustomCategories(new JumpListCustomCategory[] { category });
            }

            try {
                _jumpList.Refresh();
            }
            catch (Exception e) {
                // https://github.com/shellscape/Gmail-Notifier-Plus/issues/#issue/3
                // Unable to remove files to be replaced. (Exception from HRESULT: 0x80070497)
                Utilities.ErrorHelper.Log(e, Guid.NewGuid());
            }
        }