Пример #1
0
        /// <summary>
        /// File > Load plan from character.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miLoadPlanFromCharacter_Click(object sender, EventArgs e)
        {
            // Prompt the user to choose the source character and plan.
            using (PlanImportationFromCharacterForm cps = new PlanImportationFromCharacterForm(m_character))
            {
                DialogResult dr = cps.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                // Retrieves the cloned plan
                var plan = cps.TargetPlan;

                // Cleans any obsolete entries and fixes the prerequisites
                plan.CleanObsoleteEntries();
                plan.Fix();

                // Prompt the user for the new plan's name
                using (NewPlanWindow f = new NewPlanWindow())
                {
                    f.PlanName = m_character.Name + "-" + plan.Name;
                    f.Text     = "Save Plan As";

                    dr = f.ShowDialog();
                    if (dr == DialogResult.Cancel)
                    {
                        return;
                    }

                    plan.Name = f.Result;
                }

                // Add the plan to the character's list
                m_character.Plans.Add(plan);
            }
        }
Пример #2
0
        /// <summary>
        /// File > Load plan from character.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miLoadPlanFromCharacter_Click(object sender, EventArgs e)
        {
            // Prompt the user to choose the source character and plan.
            using (PlanImportationFromCharacterForm cps = new PlanImportationFromCharacterForm(m_character))
            {
                DialogResult dr = cps.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                // Retrieves the cloned plan
                var plan = cps.TargetPlan;

                // Adds and fixes the prerequisites order
                plan.Fix();

                // Prompt the user for the new plan's name
                using (NewPlanWindow f = new NewPlanWindow())
                {
                    f.PlanName = m_character.Name + "-" + plan.Name;
                    f.Text = "Save Plan As";

                    dr = f.ShowDialog();
                    if (dr == DialogResult.Cancel)
                        return;

                    plan.Name = f.Result;
                }

                // Add the plan to the character's list
                m_character.Plans.Add(plan);
            }
        }