From d55d921a3b4a4b2d541b6e12867fdcd09db72268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toan=20Tr=E1=BA=A7n?= Date: Mon, 6 Mar 2017 00:03:10 +0700 Subject: [PATCH] 2045: Draw Schedule --- sources/RoboforkApp/DesignerCanvas.cs | 20 +++++++++++++---- sources/RoboforkApp/RoboforkMenu.xaml | 15 ++++++++----- sources/RoboforkApp/RoboforkMenu.xaml.cs | 1 + sources/RoboforkApp/ScheduleCanvas.cs | 37 ++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 sources/RoboforkApp/ScheduleCanvas.cs diff --git a/sources/RoboforkApp/DesignerCanvas.cs b/sources/RoboforkApp/DesignerCanvas.cs index 931fe69..20f8724 100644 --- a/sources/RoboforkApp/DesignerCanvas.cs +++ b/sources/RoboforkApp/DesignerCanvas.cs @@ -83,7 +83,7 @@ namespace RoboforkApp //2017/03/04 NAM ADD END - + public ScheduleCanvas scheduleCanvas; // Add variable for Set Auto Nodes @@ -1113,7 +1113,8 @@ namespace RoboforkApp //this.Children.Add(pBlueNode); //2017/03/04 NAM ADD START this.Children.Add(pNewLine); - this.Children.Add(pScheduleLine); + //this.Children.Add(pScheduleLine); + scheduleCanvas.Children.Add(pScheduleLine); //2017/03/04 NAM ADD END } @@ -2556,7 +2557,7 @@ namespace RoboforkApp } } - node_Schedule.X = 0; + node_Schedule.X = 50; node_Schedule.Y = 100; AddNode(node_Schedule, gGrpScheduleNode); @@ -2582,7 +2583,7 @@ namespace RoboforkApp node_2 = ellipseGeometry_2.Center; DrawLine(node_1, node_2, gGrpScheduleLine); } - CreateNode(node_1, i + 1); + CreateScheduleNode(node_1, i + 1); } } } @@ -2599,6 +2600,17 @@ namespace RoboforkApp this.Children.Add(_ucNode); } + private void CreateScheduleNode(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 - 25); + Canvas.SetTop(_ucNode, point.Y - 25); + scheduleCanvas.Children.Add(_ucNode); + } + #endregion } diff --git a/sources/RoboforkApp/RoboforkMenu.xaml b/sources/RoboforkApp/RoboforkMenu.xaml index 130d286..3cfb280 100644 --- a/sources/RoboforkApp/RoboforkMenu.xaml +++ b/sources/RoboforkApp/RoboforkMenu.xaml @@ -315,12 +315,17 @@ - + + + + + + Width="{Binding ActualWidth, ElementName=MyScheduleCanvas}" + Height="{Binding ActualHeight, ElementName=MyScheduleCanvas}"> @@ -349,9 +354,9 @@ 900 100 - 200 + - + diff --git a/sources/RoboforkApp/RoboforkMenu.xaml.cs b/sources/RoboforkApp/RoboforkMenu.xaml.cs index 6daef75..1b54653 100644 --- a/sources/RoboforkApp/RoboforkMenu.xaml.cs +++ b/sources/RoboforkApp/RoboforkMenu.xaml.cs @@ -101,6 +101,7 @@ namespace RoboforkApp { MyDesignerCanvas.Init(); MyDesignerCanvas.Operation = DesignerCanvas.OperationState.NewDrawSetFreeNode; + MyDesignerCanvas.scheduleCanvas = MyScheduleCanvas; } private void btnMenu_UnselectedSet(object sender, RoutedEventArgs e) diff --git a/sources/RoboforkApp/ScheduleCanvas.cs b/sources/RoboforkApp/ScheduleCanvas.cs new file mode 100644 index 0000000..7b2b485 --- /dev/null +++ b/sources/RoboforkApp/ScheduleCanvas.cs @@ -0,0 +1,37 @@ +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.Media; +using System.Windows.Shapes; + +namespace RoboforkApp +{ + public class ScheduleCanvas : Canvas + { + // Add variable for Set Schedule + private Path pScheduleNode = new Path(); + private Path pScheduleLine = new Path(); + private GeometryGroup gGrpScheduleNode = new GeometryGroup(); + private GeometryGroup gGrpScheduleLine = new GeometryGroup(); + + public void DrawRoute(List listNode) + { + //Update after + } + + 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); + } + } +} -- 1.8.5.3