public void OnPackageListDownloadEnded(object sender, PackageListDownloadEndedEventArgs e)
 {
     if (PackageListDownloadEnded != null)
     {
         SD.Log.DebugFormatted("[AddInManager2.Events] Package list download ended (success: {0}).", e.WasSuccessful);
         PackageListDownloadEnded(sender, e);
     }
 }
        private void Events_PackageListDownloadEnded(object sender, PackageListDownloadEndedEventArgs e)
        {
            if (sender != _updatedAddInViewModel)
            {
                return;
            }

            if (e.WasCancelled)
            {
                return;
            }

            // Do we have any new updates? Collect this information from all configured repositories
            if (e.WasSuccessful)
            {
                _firstRepositoryWithUpdates = _updatedAddInViewModel.PackageRepositories.FirstOrDefault(pr => pr.HasHighlightCount);
                if (_firstRepositoryWithUpdates != null)
                {
                    // There must be updates, show an update notification
                    _hasNotified = true;
                    Detach();

                    _services.Events.AddInManagerViewOpened += Events_AddInManagerViewOpened;

                    var text = Resources.AddInManager2_UpdateNotifier_BubbleTitle;

                    _notifyIcon = new NotifyIcon
                    {
                        Icon = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location),
                        Text = text,
                        BalloonTipTitle = text,
                        BalloonTipText = Resources.AddInManager2_UpdateNotifier_BubbleText
                    };

                    _notifyIcon.Click += NotifyIcon_Click;
                    _notifyIcon.BalloonTipClicked += NotifyIcon_Click;

                    _notifyIcon.Visible = true;
                    _notifyIcon.ShowBalloonTip(40000);

                    return;
                }
            }

            Detach();
        }