예제 #1
0
            protected override void OnListValidate(ref IList _listToValidate, ref Exception _exceptionWhileValidating, ref string _messageToDisplay)
            {
                _messageToDisplay = null;

                try
                {
                    List <XY> _list = new List <XY>();
                    foreach (EditableXY _editableXY in _listToValidate)
                    {
                        _list.Add(new XY(_editableXY.X, _editableXY.Y));
                    }

                    Function _function = Function.FromPoints(_list);


                    CustomList <ICustomCollectionElement> _sortedCollection = new CustomList <ICustomCollectionElement>();
                    foreach (XY _xy in _function)
                    {
                        EditableXY _editableXY = EditableXY.From(_xy);
                        _sortedCollection.Add(_editableXY);
                    }
                }
                catch (Exception _exception)
                {
                    System.Diagnostics.Debug.WriteLine(_exception.Message);

                    _exceptionWhileValidating = _exception;
                }
            }
예제 #2
0
            public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
            {
                if ((destinationType == typeof(System.String)) &&
                    (value is EditableXY))
                {
                    EditableXY _editableXY = (EditableXY)value;
                    return(_editableXY.Y.ToString());
                }

                return(base.ConvertTo(context, culture, value, destinationType));
            }
예제 #3
0
            public static EditableFunction From(Function _function)
            {
                EditableFunction _editableFunction = new EditableFunction();

                for (int a = 0; a < _function.Length; a++)
                {
                    EditableXY _editableXY = EditableXY.From(_function[a]);
                    _editableFunction.points.Add(_editableXY);
                }

                return(_editableFunction);
            }
예제 #4
0
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                try
                {
                    EditableXY _oldEditableXY = (EditableXY)context.PropertyDescriptor.GetValue(context);

                    EditableXY _newEditableXY = new EditableXY(
                        _oldEditableXY.X,
                        double.Parse(value.ToString()));
                    return(_newEditableXY);
                }
                catch { }

                return(base.ConvertFrom(context, culture, value));
            }
예제 #5
0
            public static EditableXY From(XY _xy)
            {
                EditableXY _editableXY = new EditableXY(_xy.X, _xy.Y);

                return(_editableXY);
            }