Esempio n. 1
0
        /// <summary>
        /// Creates a <see cref="AttributesOptimizerControl"/> for a given remapping.
        /// </summary>
        /// <param name="remapping">The remapping object to represents.</param>
        /// <returns>The created control.</returns>
        private AttributesOptimizerControl CreateAttributesOptimizationControl(RemappingResult remapping)
        {
            AttributesOptimizerControl control;
            AttributesOptimizerControl ctl = null;

            try
            {
                ctl = new AttributesOptimizerControl(m_character, m_plan, remapping, m_description);
                ctl.AttributeChanged += AttributesOptimizationControl_AttributeChanged;

                // For a manually edited point, we initialize the control with the attributes from the current remapping point
                if (m_strategy == AttributeOptimizationStrategy.ManualRemappingPointEdition &&
                    m_manuallyEditedRemappingPoint.Status == RemappingPointStatus.UpToDate)
                {
                    ctl.UpdateValuesFrom(m_manuallyEditedRemappingPoint);
                }

                control = ctl;
                ctl     = null;
            }
            finally
            {
                ctl?.Dispose();
            }

            return(control);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the tab page for the given remapping
        /// </summary>
        /// <param name="remapping">The remapping.</param>
        /// <param name="tabName">Name of the tab.</param>
        private void AddTabPage(RemappingResult remapping, string tabName)
        {
            AttributesOptimizerControl ctl = CreateAttributesOptimizationControl(remapping);

            if (ctl == null)
            {
                return;
            }

            m_remappingDictionary[ctl] = remapping;

            TabPage tempPage = null;

            try
            {
                tempPage = new TabPage(tabName);
                tempPage.Controls.Add(ctl);

                TabPage page = tempPage;
                tempPage = null;

                tabControl.TabPages.Add(page);
            }
            finally
            {
                tempPage?.Dispose();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Recalculating plan and summary page after change of a <see cref="AttributesOptimizerControl"/>.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="AttributeChangedEventArgs"/> instance containing the event data.</param>
        private void AttributesOptimizationControl_AttributeChanged(object sender, AttributeChangedEventArgs e)
        {
            AttributesOptimizerControl control = (AttributesOptimizerControl)sender;

            if (m_strategy == AttributeOptimizationStrategy.RemappingPoints)
            {
                m_remappingDictionary[control] = e.Remapping;
                UpdateSummaryInformation(m_remappingDictionary.Values);
            }

            m_statisticsScratchpad = e.Remapping.BestScratchpad.Clone();
            m_remapping            = e.Remapping;

            // Update the plan order's column
            m_planEditor.ShowWithPluggable(this);
        }
Esempio n. 4
0
        /// <summary>
        /// Updates the UI once the computation has been done (for whole plan or character from birth)
        /// </summary>
        /// <param name="remapping"></param>
        private void UpdateForRemapping(RemappingResult remapping)
        {
            // Create control
            AttributesOptimizerControl ctrl = CreateAttributesOptimizationControl(remapping);

            Controls.Add(ctrl);

            IList <AttributesOptimizerControl> optControls = Controls.OfType <AttributesOptimizerControl>().ToList();

            if (optControls.Count == 1)
            {
                return;
            }

            Controls.RemoveAt(Controls.IndexOf(optControls.First()));
        }
        /// <summary>
        /// Creates a <see cref="AttributesOptimizerControl"/> for a given remapping.
        /// </summary>
        /// <param name="remapping">The remapping object to represents.</param>
        /// <returns>The created control.</returns>
        private AttributesOptimizerControl CreateAttributesOptimizationControl(RemappingResult remapping)
        {
            AttributesOptimizerControl control;
            AttributesOptimizerControl ctl = null;
            try
            {
                ctl = new AttributesOptimizerControl(m_character, m_plan, remapping, m_description);
                ctl.AttributeChanged += AttributesOptimizationControl_AttributeChanged;

                // For a manually edited point, we initialize the control with the attributes from the current remapping point
                if (m_strategy == AttributeOptimizationStrategy.ManualRemappingPointEdition &&
                    m_manuallyEditedRemappingPoint.Status == RemappingPointStatus.UpToDate)
                    ctl.UpdateValuesFrom(m_manuallyEditedRemappingPoint);

                control = ctl;
                ctl = null;
            }
            finally
            {
                ctl?.Dispose();
            }

            return control;
        }