Exemplo n.º 1
0
        protected void UpdateDelegates()
        {
            foreach (ContractParameter genericParam in this.GetAllDescendents())
            {
                ParameterDelegate <Vessel> param = genericParam as ParameterDelegate <Vessel>;
                if (param == null)
                {
                    continue;
                }

                string oldTitle = param.Title;
                if (matchingSubjects.Count == experiment.Count)
                {
                    if (param.ID.Contains("Destination:") || param.ID.Contains("Biome:") || param.ID.Contains("Situation:") ||
                        param.ID.Contains("Location:"))
                    {
                        param.ClearTitle();
                    }
                    else if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));

                        param.SetTitle(matchingSubjects[exp].title);
                        param.SetState(ParameterState.Complete);
                    }
                }
                else
                {
                    if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));
                        if (matchingSubjects.ContainsKey(exp))
                        {
                            param.SetTitle(matchingSubjects[exp].title);
                            param.SetState(ParameterState.Complete);
                        }
                        else
                        {
                            param.ClearTitle();
                        }
                    }
                    else
                    {
                        param.ResetTitle();
                    }
                }

                if (param.Title != oldTitle)
                {
                    ContractsWindow.SetParameterTitle(param, param.Title);
                    ContractConfigurator.OnParameterChange.Fire(Root, param);
                }
            }

            ContractsWindow.SetParameterTitle(this, GetTitle());
        }
Exemplo n.º 2
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;
            }
        }