diff --git a/sources/RoboforkApp/RoboforkMenu.xaml b/sources/RoboforkApp/RoboforkMenu.xaml index e91d2cb..cfd84bf 100644 --- a/sources/RoboforkApp/RoboforkMenu.xaml +++ b/sources/RoboforkApp/RoboforkMenu.xaml @@ -64,19 +64,17 @@ FontSize="17" Name="VehicleAddTree" Selected="GetVehicleAddTree" - Unselected="SetVehicleAddTree"> + Unselected="btnMenu_UnselectedSet" Tag="VehicleAddTree"> - - + + Selected="btnMenu_Selected" + Unselected="btnMenu_UnselectedSet" Tag="TaskpattermTree"> listNode) + public void CreateSimulation() { - //Update after - } + if(simulation != null || this.Children.Count < 2) + { + return; + } - private void CreateNode(Point point, int indexNode) - { - ucNode _ucNode = new ucNode(); - _ucNode.btnWidth = 20.0; - _ucNode.btnHeight = 20.0; - _ucNode.txtNode = indexNode.ToString(); - Canvas.SetLeft(_ucNode, point.X); - Canvas.SetTop(_ucNode, point.Y); - this.Children.Add(_ucNode); + PathGeometry animationPath = new PathGeometry(); + PathFigure pFigure = new PathFigure(); + pFigure.StartPoint = new Point(50, 65); + LineSegment lineSegment = new LineSegment(); + lineSegment.Point = new Point(1270, 65); + pFigure.Segments.Add(lineSegment); + animationPath.Figures.Add(pFigure); + + // Freeze the PathGeometry for performance benefits. + animationPath.Freeze(); + + // Create a MatrixAnimationUsingPath to move the + // button along the path by animating + // its MatrixTransform. + MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath(); + matrixAnimation.PathGeometry = animationPath; + matrixAnimation.Duration = TimeSpan.FromSeconds(10); + //matrixAnimation.RepeatBehavior = RepeatBehavior.Forever; + matrixAnimation.AutoReverse = false; + matrixAnimation.DoesRotateWithTangent = true; + + // Set the animation to target the Matrix property + // of the MatrixTransform named "ButtonMatrixTransform". + Storyboard.SetTargetName(matrixAnimation, "fl"); + Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty)); + + // Create a Storyboard to contain and apply the animation. + Storyboard pathAnimationStoryboard = new Storyboard(); + pathAnimationStoryboard.Children.Add(matrixAnimation); + + simulation = new simulationRobo(); + simulation.storyBoard = pathAnimationStoryboard; + this.Children.Add(simulation); } } } diff --git a/sources/RoboforkApp/UserControls/simulationRobo.xaml b/sources/RoboforkApp/UserControls/simulationRobo.xaml new file mode 100644 index 0000000..e96fd79 --- /dev/null +++ b/sources/RoboforkApp/UserControls/simulationRobo.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/RoboforkApp/UserControls/simulationRobo.xaml.cs b/sources/RoboforkApp/UserControls/simulationRobo.xaml.cs new file mode 100644 index 0000000..30aa0f4 --- /dev/null +++ b/sources/RoboforkApp/UserControls/simulationRobo.xaml.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace RoboforkApp +{ + /// + /// Interaction logic for simulationRobo.xaml + /// + public partial class simulationRobo : UserControl + { + public static readonly DependencyProperty storyBoardProperty = + DependencyProperty.Register("storyBoard", typeof(Storyboard), + typeof(simulationRobo), new FrameworkPropertyMetadata(new Storyboard())); + + public simulationRobo() + { + InitializeComponent(); + } + + public Storyboard storyBoard + { + get { return (Storyboard)GetValue(storyBoardProperty); } + set { SetValue(storyBoardProperty, value); } + } + } +}