Beispiel #1
0
            protected override bool PrivatePerform()
            {
                List <IScenarioOptionItem> options = new List <IScenarioOptionItem>();

                mManager.GetOptions(options, false, null);

                List <ScenarioOption> scenarios = new List <ScenarioOption>();

                //Common.StringBuilder msg = new Common.StringBuilder();

                foreach (IScenarioOptionItem option in options)
                {
                    Scenario scenario = option.GetScenario();
                    if (scenario == null)
                    {
                        continue;
                    }

                    ScenarioOption item = new ScenarioOption(scenario, option.GetManager());

                    /*
                     * msg += Common.NewLine + "Option: " + option.GetType();
                     * msg += Common.NewLine + "Scenario: " + scenario.GetType();
                     * msg += Common.NewLine + "Name: " + item.Name;
                     */
                    scenarios.Add(item);
                }

                //Common.WriteLog(msg);

                if (scenarios.Count == 0)
                {
                    return(false);
                }

                bool okayed = false;
                List <ScenarioOption> selection = OptionItem.ListOptions(scenarios, Name, scenarios.Count, out okayed);

                if ((selection == null) || (selection.Count == 0))
                {
                    return(false);
                }

                foreach (ScenarioOption item in selection)
                {
                    item.Perform();
                }

                return(true);
            }
        protected override bool PrivatePerform()
        {
            List <HouseholdItem> allOptions = new List <HouseholdItem>();

            foreach (Household house in Household.GetHouseholdsLivingInWorld())
            {
                allOptions.Add(new HouseholdItem(house));
            }

            SetValue(0);

            bool okayed = false;
            List <HouseholdItem> choices = OptionItem.ListOptions(allOptions, Name, 1, out okayed);

            if ((choices != null) && (choices.Count > 0))
            {
                SetValue(choices[0].Value.HouseholdId);
            }

            return(okayed);
        }