Esempio n. 1
0
        public override object ConvertBack(object value, Type targetType,
                                           object parameter, System.Globalization.CultureInfo culture)
        {
            MoveElementCommand moveElementCommand = (MoveElementCommand)MoveElementCommandFactory.Factory().Create(diagramController);

            moveElementCommand.ViewHelper = viewHelper;
            moveElementCommand.X          = viewHelper.X;

            double d;

            if (double.TryParse((string)value, out d))
            {
                if (d.Equals(viewHelper.Y))
                {
                    return(value);
                }

                moveElementCommand.Y = d;
            }
            else
            {
                return(value);
            }

            moveElementCommand.Execute();

            return(value);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates <see cref="MoveElementCommand"/> that moves an element on the diagram
        /// </summary>
        /// <param name="X">new X coordinate</param>
        /// <param name="Y">new Y coordinate</param>
        /// <param name="viewHelper">viewHelper of the moved element</param>
        /// <param name="diagramController">diagram controller</param>
        /// <returns><see cref="MoveElementCommand"/> that moves an element on the diagram</returns>
        public static MoveElementCommand CreateMoveCommand(double?X, double?Y, PositionableElementViewHelper viewHelper, DiagramController diagramController)
        {
            MoveElementCommand moveElementCommand = (MoveElementCommand)MoveElementCommandFactory.Factory().Create(diagramController);

            moveElementCommand.X          = X;
            moveElementCommand.Y          = Y;
            moveElementCommand.ViewHelper = viewHelper;
            return(moveElementCommand);
        }