/// <summary>
 /// Enqueue the skills from the given notification at the end of this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(Notification other)
 {
     var skills = ((SkillCompletionNotification)other).m_skills;
     foreach (var skill in skills)
     {
         if (!m_skills.Contains(skill))
             m_skills.Add(skill);
     }
     UpdateDescription();
 }
Exemple #2
0
        /// <summary>
        /// Update the notifications list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void EveClient_NotificationSent(object sender, Notification e)
        {
            // Updates the notifications list of the main window
            UpdateNotifications();

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

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

            // Group by account
            var groups = m_popupNotifications.GroupBy(x =>
                {
                    if (x.Sender == null)
                        return 0;

                    if (x.SenderAccount != null)
                        return x.SenderAccount.UserID;

                    if (x.SenderCharacter.Identity.Account == null)
                        return 1;

                    return x.SenderCharacter.Identity.Account.UserID;
                }).ToArray();

            // Add every group, order by character's name, accounts being on top
            var newList = new List<Notification>();
            foreach(var group in groups)
            {
                newList.AddRange(group.OrderBy(x => x.SenderCharacter == null ? "" : x.SenderCharacter.Name));
            }

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

            // If the info must be presented once only, schedule a deletion
            if (behaviour == ToolTipNotificationBehaviour.Once)
            {
                Dispatcher.Schedule(TimeSpan.FromSeconds(60), () =>
                {
                    if (!m_popupNotifications.Contains(e))
                        return;

                    m_popupNotifications.Remove(e);

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

            // Now check whether we must
            DisplayTooltipNotifications();
        }
 /// <summary>
 /// Constructor with a key gotten from a notification.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="category"></param>
 public NotificationInvalidationEventArgs(Notification notification)
 {
     m_key = notification.InvalidationKey;
 }
Exemple #4
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)
 {
     var notification = new Notification(NotificationCategory.TestNofitication, null)
     {
         Priority = NotificationPriority.Information,
         Behaviour = NotificationBehaviour.Overwrite,
         Description = "Test Notification"
     };
     EveClient.Notifications.Notify(notification);
 }
Exemple #5
0
 /// <summary>
 /// Called when a notification is sent.
 /// </summary>
 /// <param name="notification">The notification.</param>
 internal static void OnNotificationSent(Notification notification)
 {
     Trace("EveClient.OnNotificationSent - {0}", notification);
     if (NotificationSent != null)
         NotificationSent(null, notification);
 }
 /// <summary>
 /// Enqueue the orders from the given notification at the end of this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(Notification other)
 {
     var orders = ((MarketOrdersNotification)other).m_orders;
     m_orders.AddRange(orders);
     UpdateDescription();
 }
        /// <summary>
        /// On load, fils up the list for the design mode.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            if (DesignMode || this.IsDesignModeHosted())
            {
                var list = new List<Notification>();
                var notification = new Notification(NotificationCategory.AccountNotInTraining, null)
                {
                    Priority = NotificationPriority.Information,
                    Description = "Some information"
                };

                list.Add(notification);

                notification = new Notification(NotificationCategory.AccountNotInTraining, null);
                notification.Priority = NotificationPriority.Warning;
                notification.Description = "Some warning";
                list.Add(notification);

                notification = new Notification(NotificationCategory.AccountNotInTraining, null);
                notification.Priority = NotificationPriority.Error;
                notification.Description = "Some error";
                list.Add(notification);

                Notifications = list;
            }

            base.OnLoad(e);
        }
 /// <summary>
 /// Enqueue the jobs from the given notification at the end of this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(Notification other)
 {
     var jobs = ((IndustryJobsNotification)other).m_jobs;
     m_jobs.AddRange(jobs);
     UpdateDescription();
 }
        /// <summary>
        /// Displays the tooltip for the hovered item
        /// </summary>
        private void DisplayTooltip(Notification notification)
        {
            // No details ?
            if (!notification.HasDetails)
            {
                toolTip.Active = false;
                return;
            }

            // API error ?
            if (notification is APIErrorNotification)
            {
                var errorNotification = (APIErrorNotification)notification;
                toolTip.SetToolTip(listBox, errorNotification.Result.ErrorMessage);
                toolTip.Active = true;
                return;
            }

            // Skills Completion ?
            if (notification is SkillCompletionNotification)
            {
                var skillNotifications = (SkillCompletionNotification)notification;
                StringBuilder builder = new StringBuilder();
                foreach (var skill in skillNotifications.Skills.Reverse())
                {
                    builder.AppendFormat(CultureConstants.DefaultCulture,
                        "{0} {1} completed.", skill.SkillName, Skill.GetRomanForInt(skill.Level)).AppendLine();
                }
                toolTip.SetToolTip(listBox, builder.ToString());
                toolTip.Active = true;
                return;
            }

            // Market orders ?
            if (notification is MarketOrdersNotification)
            {
                var ordersNotification = (MarketOrdersNotification)notification;

                StringBuilder builder = new StringBuilder();
                foreach (var orderGroup in ordersNotification.Orders.GroupBy(x => x.State))
                {
                    if (builder.Length != 0)
                        builder.AppendLine();
                    builder.AppendLine(orderGroup.Key.GetHeader());

                    foreach (var order in orderGroup)
                    {
                        if (order.Item == null)
                            continue;

                        var format = AbbreviationFormat.AbbreviationSymbols;

                        // Expired :    12k/15k invulnerability fields at Pator V - Tech School
                        // Fulfilled :  15k invulnerability fields at Pator V - Tech School
                        if (order.State == OrderState.Expired)
                            builder.Append(MarketOrder.Format(order.RemainingVolume, format)).Append("/");

                        builder.Append(MarketOrder.Format(order.InitialVolume, format)).Append(" ");
                        builder.Append(order.Item.Name).Append(" at ");
                        builder.AppendLine(order.Station.Name);
                    }
                }
                toolTip.SetToolTip(listBox, builder.ToString());
                toolTip.Active = true;
                return;
            }

            // Industry jobs ?
            if (notification is IndustryJobsNotification)
            {
                var jobsNotification = (IndustryJobsNotification)notification;

                StringBuilder builder = new StringBuilder();
                foreach (var job in jobsNotification.Jobs)
                {
                    if (job.InstalledItem == null)
                        continue;

                    builder.Append(job.InstalledItem.Name).Append(" at ");
                    builder.AppendFormat(CultureConstants.DefaultCulture, "{0} > {1}", job.SolarSystem.Name, job.Installation).AppendLine();
                }
                toolTip.SetToolTip(listBox, builder.ToString());
                toolTip.Active = true;
                return;
            }
        }
        /// <summary>
        /// Show the details for the given notification.
        /// </summary>
        /// <param name="notification"></param>
        private static void ShowDetails(Notification notification)
        {
            // API error ?
            if (notification is APIErrorNotification)
            {
                var window = WindowsFactory<APIErrorWindow>.ShowUnique();
                window.Notification = (APIErrorNotification)notification;
                return;
            }

            // Skills Completion ?
            if (notification is SkillCompletionNotification)
            {
                var window = WindowsFactory<SkillCompletionWindow>.ShowUnique();
                window.Notification = (SkillCompletionNotification)notification;
                return;
            }

            // Market orders ?
            if (notification is MarketOrdersNotification)
            {
                var ordersNotification = (MarketOrdersNotification)notification;
                var window = WindowsFactory<MarketOrdersWindow>.ShowUnique();
                window.Orders = ordersNotification.Orders;
                window.Columns = Settings.UI.MainWindow.MarketOrders.Columns;
                window.Grouping = MarketOrderGrouping.State;
                window.ShowIssuedFor = IssuedFor.All;
                return;
            }

            // Industry jobs ?
            if (notification is IndustryJobsNotification)
            {
                var jobsNotification = (IndustryJobsNotification)notification;
                var window = WindowsFactory<IndustryJobsWindow>.ShowUnique();
                window.Jobs = jobsNotification.Jobs;
                window.Columns = Settings.UI.MainWindow.IndustryJobs.Columns;
                window.Grouping = IndustryJobGrouping.State;
                window.ShowIssuedFor = IssuedFor.All;
                return;
            }
        }
Exemple #11
0
 /// <summary>
 /// Appends a given notification to this one.
 /// </summary>
 /// <param name="?"></param>
 public virtual void Append(Notification other)
 {
     // Must have to be implemented by inheritors.
     throw new NotImplementedException();
 }
 /// <summary>
 /// Adds the number of new mail messages from the given notification to this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(Notification other)
 {
     var notifications = ((NewEveNotificationNotification)other).NewNotificationsCount;
     NewNotificationsCount += notifications;
     UpdateDescription();
 }
 /// <summary>
 /// Adds the number of new mail messages from the given notification to this notification.
 /// </summary>
 /// <param name="other"></param>
 public override void Append(Notification other)
 {
     var mailMessages = ((NewEveMailMessageNotification)other).NewMailMessagesCount;
     NewMailMessagesCount += mailMessages;
     UpdateDescription();
 }