Commit d55d921a3b4a4b2d541b6e12867fdcd09db72268
1 parent
160b9bec85
Exists in
master
2045: Draw Schedule
Showing 4 changed files with 64 additions and 9 deletions Side-by-side Diff
sources/RoboforkApp/DesignerCanvas.cs
... | ... | @@ -83,9 +83,9 @@ |
83 | 83 | //2017/03/04 NAM ADD END |
84 | 84 | |
85 | 85 | |
86 | + public ScheduleCanvas scheduleCanvas; | |
86 | 87 | |
87 | 88 | |
88 | - | |
89 | 89 | // Add variable for Set Auto Nodes |
90 | 90 | public Path pBlueNode = new Path(); |
91 | 91 | private GeometryGroup gGrpBlueNode = new GeometryGroup(); |
... | ... | @@ -1113,7 +1113,8 @@ |
1113 | 1113 | //this.Children.Add(pBlueNode); |
1114 | 1114 | //2017/03/04 NAM ADD START |
1115 | 1115 | this.Children.Add(pNewLine); |
1116 | - this.Children.Add(pScheduleLine); | |
1116 | + //this.Children.Add(pScheduleLine); | |
1117 | + scheduleCanvas.Children.Add(pScheduleLine); | |
1117 | 1118 | //2017/03/04 NAM ADD END |
1118 | 1119 | } |
1119 | 1120 | |
... | ... | @@ -2556,7 +2557,7 @@ |
2556 | 2557 | } |
2557 | 2558 | } |
2558 | 2559 | |
2559 | - node_Schedule.X = 0; | |
2560 | + node_Schedule.X = 50; | |
2560 | 2561 | node_Schedule.Y = 100; |
2561 | 2562 | AddNode(node_Schedule, gGrpScheduleNode); |
2562 | 2563 | |
... | ... | @@ -2582,7 +2583,7 @@ |
2582 | 2583 | node_2 = ellipseGeometry_2.Center; |
2583 | 2584 | DrawLine(node_1, node_2, gGrpScheduleLine); |
2584 | 2585 | } |
2585 | - CreateNode(node_1, i + 1); | |
2586 | + CreateScheduleNode(node_1, i + 1); | |
2586 | 2587 | } |
2587 | 2588 | } |
2588 | 2589 | } |
... | ... | @@ -2597,6 +2598,17 @@ |
2597 | 2598 | Canvas.SetLeft(_ucNode, point.X); |
2598 | 2599 | Canvas.SetTop(_ucNode, point.Y); |
2599 | 2600 | this.Children.Add(_ucNode); |
2601 | + } | |
2602 | + | |
2603 | + private void CreateScheduleNode(Point point, int indexNode) | |
2604 | + { | |
2605 | + ucNode _ucNode = new ucNode(); | |
2606 | + _ucNode.btnWidth = 20.0; | |
2607 | + _ucNode.btnHeight = 20.0; | |
2608 | + _ucNode.txtNode = indexNode.ToString(); | |
2609 | + Canvas.SetLeft(_ucNode, point.X - 25); | |
2610 | + Canvas.SetTop(_ucNode, point.Y - 25); | |
2611 | + scheduleCanvas.Children.Add(_ucNode); | |
2600 | 2612 | } |
2601 | 2613 | |
2602 | 2614 | #endregion |
sources/RoboforkApp/RoboforkMenu.xaml
... | ... | @@ -315,12 +315,17 @@ |
315 | 315 | </Grid> |
316 | 316 | <Border Grid.Column="1" BorderThickness="1" BorderBrush="Red" Margin="5,5,5,5"> |
317 | 317 | |
318 | - <s:DesignerCanvas x:Name="MyDesignerCanvasSchedule" | |
318 | + <s:ScheduleCanvas x:Name="MyScheduleCanvas" | |
319 | 319 | AllowDrop="True" |
320 | 320 | Background="White" HorizontalAlignment="Stretch"> |
321 | + <Canvas.LayoutTransform> | |
322 | + <!--Adjust ScaleX and ScaleY in lock-step to zoom--> | |
323 | + <ScaleTransform ScaleX=".57" ScaleY=".57" CenterX=".57" CenterY=".57" /> | |
324 | + </Canvas.LayoutTransform> | |
325 | + | |
321 | 326 | <Grid Name="MCGridShedule" Background="White" ShowGridLines="True" |
322 | - Width="{Binding ActualWidth, ElementName=MyDesignerCanvasSchedule}" | |
323 | - Height="{Binding ActualHeight, ElementName=MyDesignerCanvasSchedule}"> | |
327 | + Width="{Binding ActualWidth, ElementName=MyScheduleCanvas}" | |
328 | + Height="{Binding ActualHeight, ElementName=MyScheduleCanvas}"> | |
324 | 329 | |
325 | 330 | <Grid.RowDefinitions> |
326 | 331 | <RowDefinition Height="1*"/> |
327 | 332 | |
... | ... | @@ -349,9 +354,9 @@ |
349 | 354 | <TextBlock Grid.Row="0" Grid.Column="9" Foreground="SkyBlue">900</TextBlock> |
350 | 355 | |
351 | 356 | <TextBlock Grid.Row="1" Grid.Column="0" Foreground="SkyBlue">100</TextBlock> |
352 | - <TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock> | |
357 | + <!--<TextBlock Grid.Row="2" Grid.Column="0" Foreground="SkyBlue">200</TextBlock>--> | |
353 | 358 | </Grid> |
354 | - </s:DesignerCanvas> | |
359 | + </s:ScheduleCanvas> | |
355 | 360 | |
356 | 361 | </Border> |
357 | 362 | </Grid> |
sources/RoboforkApp/RoboforkMenu.xaml.cs
... | ... | @@ -101,6 +101,7 @@ |
101 | 101 | { |
102 | 102 | MyDesignerCanvas.Init(); |
103 | 103 | MyDesignerCanvas.Operation = DesignerCanvas.OperationState.NewDrawSetFreeNode; |
104 | + MyDesignerCanvas.scheduleCanvas = MyScheduleCanvas; | |
104 | 105 | } |
105 | 106 | |
106 | 107 | private void btnMenu_UnselectedSet(object sender, RoutedEventArgs e) |
sources/RoboforkApp/ScheduleCanvas.cs
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using System.Windows; | |
7 | +using System.Windows.Controls; | |
8 | +using System.Windows.Media; | |
9 | +using System.Windows.Shapes; | |
10 | + | |
11 | +namespace RoboforkApp | |
12 | +{ | |
13 | + public class ScheduleCanvas : Canvas | |
14 | + { | |
15 | + // Add variable for Set Schedule | |
16 | + private Path pScheduleNode = new Path(); | |
17 | + private Path pScheduleLine = new Path(); | |
18 | + private GeometryGroup gGrpScheduleNode = new GeometryGroup(); | |
19 | + private GeometryGroup gGrpScheduleLine = new GeometryGroup(); | |
20 | + | |
21 | + public void DrawRoute(List<ucNode> listNode) | |
22 | + { | |
23 | + //Update after | |
24 | + } | |
25 | + | |
26 | + private void CreateNode(Point point, int indexNode) | |
27 | + { | |
28 | + ucNode _ucNode = new ucNode(); | |
29 | + _ucNode.btnWidth = 20.0; | |
30 | + _ucNode.btnHeight = 20.0; | |
31 | + _ucNode.txtNode = indexNode.ToString(); | |
32 | + Canvas.SetLeft(_ucNode, point.X); | |
33 | + Canvas.SetTop(_ucNode, point.Y); | |
34 | + this.Children.Add(_ucNode); | |
35 | + } | |
36 | + } | |
37 | +} |