Ejemplo n.º 1
0
        /// <summary>
        /// Executes the command.
        /// Deletes the selected Items.
        /// If none is selected, it requests a selection.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Canguro.Model.Model model = services.Model;
            if (model.LoadCases.Count > 1)
            {
                Canguro.Model.Load.LoadCase oldCase = model.ActiveLoadCase;

                // Remove associated AnalysisCase
                // Find the corresponding AbstractCase
                Canguro.Model.Load.AnalysisCase aCase = null;
                foreach (Canguro.Model.Load.AbstractCase ac in services.Model.AbstractCases)
                {
                    if (ac is Canguro.Model.Load.AnalysisCase && ac.Name.Equals(oldCase.Name))
                    {
                        aCase = (Canguro.Model.Load.AnalysisCase)ac;
                        break;
                    }
                }

                bool deleteLCase = true;
                // Now remove the AnalysisCase
                if (aCase != null)
                {
                    deleteLCase = services.Model.AbstractCases.Remove(aCase);
                }

                if (deleteLCase)
                {
                    services.Model.LoadCases.Remove(oldCase.Name);
                    services.Model.ChangeModel();
                }
            }
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            Canguro.Model.Load.AnalysisCase ac = AbstractCase as Canguro.Model.Load.AnalysisCase;
            if (ac != null && ac.Properties != null && ac.Properties is Canguro.Model.Load.ModalCaseProps)
            {
                // Fetch Period
                Results results = Canguro.Model.Model.Instance.Results;
                if (results != null)
                {
                    float[] period = results.GetModalPeriods(this);

                    if (period != null)
                    {
                        return(Name + " (" + period[0].ToString("G5") + Canguro.Model.Model.Instance.UnitSystem.UnitName(Canguro.Model.UnitSystem.Units.Time) + ")");
                    }
                }
            }


            return(Name);
        }