Esempio n. 1
0
 /// <summary>
 /// Enqueue the skills from the given notification at the end of this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(NotificationEventArgs other)
 {
     List<QueuedSkill> skills = ((SkillCompletionNotificationEventArgs)other).Skills.ToList();
     foreach (QueuedSkill skill in skills.Where(skill => !Skills.Contains(skill)))
     {
         Skills.Add(skill);
     }
     UpdateDescription();
 }
Esempio n. 2
0
        /// <summary>
        /// Enqueue the contracts from the given notification at the end of this notification.
        /// </summary>
        /// <param name="other"></param>
        public override void Append(NotificationEventArgs other)
        {
            foreach (Contract contract in ((ContractsNotificationEventArgs)other).Contracts.Where(x => !x.NotificationSend))
            {
                Contracts.Add(contract);
            }

            UpdateDescription();
        }
Esempio n. 3
0
        /// <summary>
        /// Enqueue the jobs from the given notification at the end of this notification.
        /// </summary>
        /// <param name="other"></param>
        public override void Append(NotificationEventArgs other)
        {
            foreach (PlanetaryPin pin in ((PlanetaryPinsNotificationEventArgs)other).PlanetaryPins)
            {
                PlanetaryPins.Add(pin);
            }

            UpdateDescription();
        }
Esempio n. 4
0
        /// <summary>
        /// Enqueue the jobs from the given notification at the end of this notification.
        /// </summary>
        /// <param name="other"></param>
        public override void Append(NotificationEventArgs other)
        {
            foreach (IndustryJob job in ((IndustryJobsNotificationEventArgs)other).Jobs)
            {
                Jobs.Add(job);
            }

            UpdateDescription();
        }
Esempio n. 5
0
        /// <summary>
        /// Enqueue the orders from the given notification at the end of this notification.
        /// </summary>
        /// <param name="other"></param>
        public override void Append(NotificationEventArgs other)
        {
            foreach (MarketOrder order in ((MarketOrdersNotificationEventArgs)other).Orders)
            {
                Orders.Add(order);
            }

            UpdateDescription();
        }
Esempio n. 6
0
 /// <summary>
 /// Tests character's notification display in the Character Monitor.
 /// </summary>
 internal static void TestCharacterNotification(Character character)
 {
     NotificationEventArgs notification = new NotificationEventArgs(character, NotificationCategory.TestNofitication)
                                              {
                                                  Priority = NotificationPriority.Warning,
                                                  Behaviour = NotificationBehaviour.Overwrite,
                                                  Description = "Test Character Notification."
                                              };
     EveMonClient.Notifications.Notify(notification);
 }
Esempio n. 7
0
        /// <summary>
        /// Update the notifications list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EveMonClient_NotificationSent(object sender, NotificationEventArgs e)
        {
            // Updates the notifications list of the main window
            UpdateNotifications();

            // Takes care of the tooltip
            NotificationCategorySettings catSettings = Settings.Notifications.Categories[e.Category];
            ToolTipNotificationBehaviour behaviour = catSettings.ToolTipBehaviour;
            if (behaviour == ToolTipNotificationBehaviour.Never)
                return;

            // Add and reorder by API key and character
            m_popupNotifications.Add(e);

            // Group by API key
            IEnumerable<IGrouping<long, NotificationEventArgs>> groups = m_popupNotifications
                .GroupBy(
                    notification =>
                    {
                        // It's an API server related notification
                        if (notification.Sender == null)
                            return 0;

                        // It's an API key related notification
                        if (notification.SenderAPIKey != null)
                            return notification.SenderAPIKey.ID;

                        // It's a corporation related notification
                        if (notification.SenderCorporation != null)
                            return notification.SenderCorporation.ID;

                        // It's a character related notification
                        return notification.SenderCharacter is UriCharacter
                            ? 1
                            : notification.SenderCharacter.CharacterID;
                    });

            // Add every group, order by character's name, accounts being on top
            List<NotificationEventArgs> newList = new List<NotificationEventArgs>();
            foreach (IGrouping<long, NotificationEventArgs> group in groups)
            {
                newList.AddRange(group.OrderBy(x => x.SenderCharacter?.Name ?? String.Empty));
            }

            m_popupNotifications.Clear();
            m_popupNotifications.AddRange(newList);

            // If the info must be presented once only, schedule a deletion
            if (behaviour == ToolTipNotificationBehaviour.Once)
            {
                NotificationEventArgs.ScheduleAction(TimeSpan.FromMinutes(1),
                    () =>
                    {
                        if (!m_popupNotifications.Contains(e))
                            return;

                        m_popupNotifications.Remove(e);

                        if (m_popupNotifications.Count == 0)
                            niAlertIcon.Visible = false;
                    });
            }

            // Now check whether we must 
            DisplayTooltipNotifications();
        }
Esempio n. 8
0
 /// <summary>
 /// Tests notification display in the MainWindow.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void testNotificationToolstripMenuItem_Click(object sender, EventArgs e)
 {
     NotificationEventArgs notification = new NotificationEventArgs(null, NotificationCategory.TestNofitication)
     {
         Priority = NotificationPriority.Information,
         Behaviour = NotificationBehaviour.Overwrite,
         Description = "Test Notification"
     };
     EveMonClient.Notifications.Notify(notification);
 }
Esempio n. 9
0
 /// <summary>
 /// Adds the number of new mail messages from the given notification to this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(NotificationEventArgs other)
 {
     m_newMailMessagesCount += ((EveMailMessageNotificationEventArgs)other).m_newMailMessagesCount;
     UpdateDescription();
 }
Esempio n. 10
0
        /// <summary>
        /// Displays the tooltip for the hovered item.
        /// </summary>
        private void DisplayTooltip(NotificationEventArgs notification)
        {
            // No details ?
            if (!notification.HasDetails)
            {
                SetToolTip(active: false);
                return;
            }

            // API error ?
            APIErrorNotificationEventArgs errorNotification = notification as APIErrorNotificationEventArgs;
            if (errorNotification != null)
            {
                SetToolTip(errorNotification.Result.ErrorMessage);
                return;
            }

            // Skills Completion ?
            SkillCompletionNotificationEventArgs skillNotifications = notification as SkillCompletionNotificationEventArgs;
            if (skillNotifications != null)
            {
                SetToolTip(SkillCompletionMessage(skillNotifications));
                return;
            }

            // Market orders ?
            MarketOrdersNotificationEventArgs ordersNotification = notification as MarketOrdersNotificationEventArgs;
            if (ordersNotification != null)
            {
                SetToolTip(MarketOrdersEndedMessage(ordersNotification));
                return;
            }

            // Contracts ?
            ContractsNotificationEventArgs contractsNotification = notification as ContractsNotificationEventArgs;
            if (contractsNotification != null)
            {
                SetToolTip(ContractsEndedMessage(contractsNotification));
                return;
            }

            // Industry jobs ?
            IndustryJobsNotificationEventArgs jobsNotification = notification as IndustryJobsNotificationEventArgs;
            if (jobsNotification != null)
            {
                SetToolTip(IndustryJobsCompletedMessage(jobsNotification));
                return;
            }

            // Planetary pins ?
            PlanetaryPinsNotificationEventArgs pinsNotification = notification as PlanetaryPinsNotificationEventArgs;
            if (pinsNotification != null)
            {
                SetToolTip(PlanetaryPinsCompletedMessage(pinsNotification));
                return;
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Appends a given notification to this one.
 /// </summary>
 /// <param name="other"></param>
 public virtual void Append(NotificationEventArgs other)
 {
     // Must have to be implemented by inheritors
     throw new NotImplementedException();
 }
Esempio n. 12
0
        /// <summary>
        /// Called when a notification is sent.
        /// </summary>
        /// <param name="notification">The notification.</param>
        internal static void OnNotificationSent(NotificationEventArgs notification)
        {
            if (Closed)
                return;

            Trace(notification.ToString());
            NotificationSent?.ThreadSafeInvoke(null, notification);
        }
 /// <summary>
 /// Adds the number of new mail messages from the given notification to this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(NotificationEventArgs other)
 {
     m_newNotificationsCount += ((EveNotificationEventArgs)other).m_newNotificationsCount;
     UpdateDescription();
 }
Esempio n. 14
0
        /// <summary>
        /// Constructor with a key gotten from a notification.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <exception cref="System.ArgumentNullException">notification</exception>
        public NotificationInvalidationEventArgs(NotificationEventArgs notification)
        {
            notification.ThrowIfNull(nameof(notification));

            Key = notification.InvalidationKey;
        }
Esempio n. 15
0
        /// <summary>
        /// Show the details for the given notification.
        /// </summary>
        /// <param name="notification"></param>
        private static void ShowDetails(NotificationEventArgs notification)
        {
            // API error ?
            APIErrorNotificationEventArgs errorNotification = notification as APIErrorNotificationEventArgs;
            if (errorNotification != null)
            {
                ApiErrorWindow window = WindowsFactory.ShowByTag<ApiErrorWindow, APIErrorNotificationEventArgs>(errorNotification);
                window.Notification = errorNotification;
                return;
            }

            // Skills Completion ?
            SkillCompletionNotificationEventArgs skillNotifications = notification as SkillCompletionNotificationEventArgs;
            if (skillNotifications != null)
            {
                SkillCompletionWindow window =
                    WindowsFactory.ShowByTag<SkillCompletionWindow, SkillCompletionNotificationEventArgs>(skillNotifications);
                window.Notification = skillNotifications;
                return;
            }

            // Market orders ?
            MarketOrdersNotificationEventArgs ordersNotification = notification as MarketOrdersNotificationEventArgs;
            if (ordersNotification != null)
            {
                MarketOrdersWindow window =
                    WindowsFactory.ShowByTag<MarketOrdersWindow, MarketOrdersNotificationEventArgs>(ordersNotification);
                window.Orders = ordersNotification.Orders;
                window.Columns = Settings.UI.MainWindow.MarketOrders.Columns;
                window.Grouping = MarketOrderGrouping.State;
                window.ShowIssuedFor = IssuedFor.All;
                return;
            }

            // Contracts ?
            ContractsNotificationEventArgs contractsNotification = notification as ContractsNotificationEventArgs;
            if (contractsNotification != null)
            {
                ContractsWindow window =
                    WindowsFactory.ShowByTag<ContractsWindow, ContractsNotificationEventArgs>(contractsNotification);
                window.Contracts = contractsNotification.Contracts;
                window.Columns = Settings.UI.MainWindow.Contracts.Columns;
                window.Grouping = ContractGrouping.State;
                window.ShowIssuedFor = IssuedFor.All;
                return;
            }

            // Industry jobs ?
            IndustryJobsNotificationEventArgs jobsNotification = notification as IndustryJobsNotificationEventArgs;
            if (jobsNotification != null)
            {
                IndustryJobsWindow window =
                    WindowsFactory.ShowByTag<IndustryJobsWindow, IndustryJobsNotificationEventArgs>(jobsNotification);
                window.Jobs = jobsNotification.Jobs;
                window.Columns = Settings.UI.MainWindow.IndustryJobs.Columns;
                window.Grouping = IndustryJobGrouping.State;
                window.ShowIssuedFor = IssuedFor.All;
                return;
            }

            // Planetary pins ?
            PlanetaryPinsNotificationEventArgs pinsNotification = notification as PlanetaryPinsNotificationEventArgs;
            if (pinsNotification != null)
            {
                PlanetaryPinsWindow window =
                    WindowsFactory.ShowByTag<PlanetaryPinsWindow, PlanetaryPinsNotificationEventArgs>(pinsNotification);
                window.PlanetaryPins = pinsNotification.PlanetaryPins;
                window.Columns = Settings.UI.MainWindow.Planetary.Columns;
                window.Grouping = PlanetaryGrouping.Colony;
                return;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Handles the NotificationSent event of the EveMonClient control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EVEMon.Common.Notifications.NotificationEventArgs"/> instance containing the event data.</param>
        private void EveMonClient_NotificationSent(object sender, NotificationEventArgs e)
        {
            APIErrorNotificationEventArgs notification = e as APIErrorNotificationEventArgs;
            if (notification == null)
                return;

            CCPAPIResult<SerializableAPIMailBodies> eveMailBodiesResult = notification.Result as CCPAPIResult<SerializableAPIMailBodies>;
            CCPAPIResult<SerializableAPINotificationTexts> notificationTextResult = notification.Result as CCPAPIResult<SerializableAPINotificationTexts>;
            if (eveMailBodiesResult == null && notificationTextResult == null)
                return;

            // In case there was an error, close the window
            if (notification.Result.HasError)
                Close();
        }
Esempio n. 17
0
 /// <summary>
 /// Appends a given notification to this one.
 /// </summary>
 /// <param name="other"></param>
 public virtual void Append(NotificationEventArgs other)
 {
     // Must have to be implemented by inheritors
     throw new NotImplementedException();
 }