Example #1
0
        /// <summary>
        /// Builds the ended contracts message.
        /// </summary>
        /// <param name="contractsNotification">The <see cref="EVEMon.Common.Notifications.ContractsNotificationEventArgs"/> instance containing the event data.</param>
        /// <returns></returns>
        private static string ContractsEndedMessage(ContractsNotificationEventArgs contractsNotification)
        {
            StringBuilder builder = new StringBuilder();

            foreach (IGrouping <ContractState, Contract> contractGroup in contractsNotification.
                     Contracts.GroupBy(x => x.State))
            {
                if (builder.Length != 0)
                {
                    builder.AppendLine();
                }

                builder.AppendLine(contractGroup.Key.GetHeader());

                foreach (Contract contract in contractGroup)
                {
                    if (!contract.Issuer.IsEmptyOrUnknown())
                    {
                        builder.Append(contract.ContractText).Append(" | ").
                        Append(contract.ContractType).Append(" | ").
                        Append(contract.Status).Append(" | ");
                        if (contract.State == ContractState.Finished)
                        {
                            builder.Append("Accepted by  ").Append(contract.Acceptor);
                        }
                        builder.Append(" at ").AppendLine(contract.StartStation?.Name ??
                                                          EveMonConstants.UnknownText);
                    }
                }
            }
            return(builder.ToString());
        }
Example #2
0
        /// <summary>
        /// Builds the ended contracts message.
        /// </summary>
        /// <param name="contractsNotification">The <see cref="EVEMon.Common.Notifications.ContractsNotificationEventArgs"/> instance containing the event data.</param>
        /// <returns></returns>
        private static String ContractsEndedMessage(ContractsNotificationEventArgs contractsNotification)
        {
            StringBuilder builder = new StringBuilder();

            foreach (IGrouping <ContractState, Contract> contractGroup in contractsNotification.Contracts.GroupBy(x => x.State))
            {
                if (builder.Length != 0)
                {
                    builder.AppendLine();
                }

                builder.AppendLine(contractGroup.Key.GetHeader());

                foreach (Contract contract in contractGroup.Where(contract => !String.IsNullOrEmpty(contract.Issuer)))
                {
                    builder
                    .Append(contract.ContractText)
                    .Append(" | ")
                    .Append(contract.ContractType)
                    .Append(" | ")
                    .Append(contract.Status)
                    .Append(" | ");

                    if (contract.State == ContractState.Finished)
                    {
                        builder
                        .Append("Accepted by  ")
                        .Append(contract.Acceptor);
                    }

                    builder
                    .Append(" at ")
                    .AppendLine(contract.StartStation.Name);
                }
            }
            return(builder.ToString());
        }
Example #3
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;
            }
        }
Example #4
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;
            }
        }