Пример #1
0
        /// <summary>
        /// Executes the command.
        /// Gets the Load Case properties from the User, adds it to the Model and sets it as Active.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            string   name  = Culture.Get("defaultLoadCase");
            LoadCase lCase = new LoadCase(name, LoadCase.LoadCaseType.Dead);

            lCase.Name = name;
//            services.GetProperties(lCase.Name, lCase, false);

            EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!services.Model.LoadCases.ContainsKey(lCase.Name))
                {
                    services.Model.LoadCases.Add(lCase.Name, lCase);
                }
                services.Model.ActiveLoadCase = lCase;

                AnalysisCase    aCase = new AnalysisCase(lCase.Name);
                StaticCaseProps props = aCase.Properties as StaticCaseProps;
                if (props != null)
                {
                    List <StaticCaseFactor> list = props.Loads;
                    list.Add(new StaticCaseFactor(lCase));
                    props.Loads = list;
                    services.Model.AbstractCases.Add(aCase);
                }
            }
            else
            {
                services.Model.Undo.Rollback();
            }
        }
Пример #2
0
        /// <summary>
        /// Executes the command.
        /// Opens the properties window to edit the Active Load Case.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Canguro.Model.Load.LoadCase lCase = services.Model.ActiveLoadCase;
            string name = lCase.Name;
            //services.GetProperties(name, lCase, false);

            EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!name.Equals(lCase.Name))
                {
                    foreach (Canguro.Model.Load.AbstractCase aCase in services.Model.AbstractCases)
                    {
                        if (name.Equals(aCase.Name) && aCase is Canguro.Model.Load.AnalysisCase)
                        {
                            aCase.Name = lCase.Name;
                        }
                    }
                }

                services.Model.ChangeModel();
            }
            else
            {
                services.Model.Undo.Rollback();
            }
        }