コード例 #1
0
        /// <summary>
        ///     Handles the SelectedIndexChanged event of the _styleManagerTypeCmb control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        /// <exception cref="System.InvalidOperationException"></exception>
        private void _styleManagerTypeCmb_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxValue <Type> val = (ComboBoxValue <Type>)_styleManagerTypeCmb.SelectedItem;

            TilingController controller = _tilingController;

            if (controller == null)
            {
                return;
            }
            lock (_lock)
            {
                controller = _tilingController;
                if (controller == null)
                {
                    return;
                }

                StyleManager currManager = controller.StyleManager;
                if (currManager.GetType() == val.Value)
                {
                    return;
                }

                StyleManager newManager;

                if (val.Value == typeof(RandomStyleManager))
                {
                    newManager = new RandomStyleManager((int)_seedNum.Value, currManager.LineStyle, currManager.Styles);
                }
                else if (val.Value == typeof(RandomGreedyStyleManager))
                {
                    newManager = new RandomGreedyStyleManager(
                        (int)_seedNum.Value,
                        currManager.LineStyle,
                        currManager.Styles);
                }
                else if (val.Value == typeof(GreedyStyleManager))
                {
                    newManager = new GreedyStyleManager(1, 1, 1, currManager.LineStyle, currManager.Styles);
                }
                else if (val.Value == typeof(SimpleStyleManager))
                {
                    // TODO filter styles properly when multiple shapes are supported
                    newManager = new SimpleStyleManager(currManager.LineStyle, currManager.Styles.First());
                }
                else
                {
                    throw new InvalidOperationException();
                }

                Debug.Assert(newManager.GetType() == val.Value);

                controller.Tiling.SetStyleManager(newManager, controller.Tiles);
                UpdateStyleManager(newManager);
            }
        }
コード例 #2
0
        /// <summary>
        ///     Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <returns>
        ///     true if the specified object  is equal to the current object; otherwise, false.
        /// </returns>
        /// <param name="obj">The object to compare with the current object. </param>
        public override bool Equals(object obj)
        {
            ComboBoxValue <T> val = obj as ComboBoxValue <T>;

            if (val != null)
            {
                return(Equals(Value, val.Value));
            }
            return(Equals(Value, obj));
        }
コード例 #3
0
        /// <summary>
        ///     Handles the SelectedIndexChanged event of the _changeLineTypeCmb control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void changeLineTypeCmb_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxValue <Type> val = (ComboBoxValue <Type>)_changeLineTypeCmb.SelectedItem;

            if (_tilingController != null)
            {
                _tilingController.EditLine.ChangeLineOption.Value = val.Value;
                IsDirty = true;
            }
        }