Ejemplo n.º 1
0
        /// <summary>
        /// Identifies if there are obsolete entries in the skill plan,
        /// displays message if required.
        /// </summary>
        public void CheckObsoleteEntries()
        {
            switch (Settings.UI.PlanWindow.ObsoleteEntryRemovalBehaviour)
            {
            case ObsoleteEntryRemovalBehaviour.AlwaysAsk:
                ObsoleteEntriesStatusLabel.Visible = m_plan.ContainsObsoleteEntries;
                break;

            case ObsoleteEntryRemovalBehaviour.RemoveAll:
                m_plan.CleanObsoleteEntries(ObsoleteRemovalPolicy.RemoveAll);
                break;

            case ObsoleteEntryRemovalBehaviour.RemoveConfirmed:
                m_plan.CleanObsoleteEntries(ObsoleteRemovalPolicy.ConfirmedOnly);
                ObsoleteEntriesStatusLabel.Visible = m_plan.ContainsObsoleteEntries;
                break;

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// File > Load plan from file.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miLoadPlanFromFile_Click(object sender, EventArgs e)
        {
            // Prompt the user to select a file
            DialogResult dr = ofdOpenDialog.ShowDialog();

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

            // Load from file and returns if an error occured (user has already been warned)
            var serial = PlanExporter.ImportFromXML(ofdOpenDialog.FileName);

            if (serial == null)
            {
                return;
            }

            // Imports the plan
            Plan loadedPlan = new Plan(m_character);

            loadedPlan.Import(serial);

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

            // Prompt the user for the plan name
            using (NewPlanWindow npw = new NewPlanWindow())
            {
                npw.PlanName = Path.GetFileNameWithoutExtension(ofdOpenDialog.FileName);
                DialogResult xdr = npw.ShowDialog();
                if (xdr == DialogResult.Cancel)
                {
                    return;
                }

                loadedPlan.Name = npw.Result;
                m_character.Plans.Add(loadedPlan);
            }
        }