Commit 160b9bec85381381f5d8e0199102d7517151f5f4

Authored by nguyen_nam
1 parent b338e1ff57
Exists in master

Tbl Node info

Showing 1 changed file with 57 additions and 16 deletions Side-by-side Diff

sources/RoboforkApp/DesignerCanvas.cs
... ... @@ -399,11 +399,12 @@
399 399 else if (Operation == OperationState.NewDrawSetFreeNode)
400 400 {
401 401 bool RightClick = false;
  402 + bool LeftClick = false;
402 403 if (IsStopDrawRoute(e))
403 404 RightClick = true;
404 405  
405 406 StartDrawPoint = e.MouseDevice.GetPosition(this);
406   - CreateNode(StartDrawPoint, RightClick);
  407 + CreateNode(StartDrawPoint,LeftClick, RightClick);
407 408 //NewSetFreeNodes(StartDrawPoint, RightClick);
408 409 }
409 410 //2017/03/04 NAM EDT END
410 411  
... ... @@ -691,7 +692,25 @@
691 692  
692 693 return;
693 694 }
  695 + //2017/03/04 NAM EDT START
  696 + else
  697 + {
694 698  
  699 + bool RightClick = false;
  700 + bool LeftClick = false;
  701 +
  702 +
  703 + if (IsMouseLeftClick(e))
  704 + LeftClick = true;
  705 + if (IsStopDrawRoute(e))
  706 + RightClick = true;
  707 +
  708 + StartDrawPoint = e.MouseDevice.GetPosition(this);
  709 + CreateNode(StartDrawPoint, LeftClick, RightClick);
  710 + }
  711 + //2017/03/04 NAM EDT END
  712 +
  713 +
695 714 bool _isgoal = IsStartEndRoute(_goalPoint, LastPoint);
696 715 if (_isgoal && isGoalDrawRoute == false)
697 716 {
... ... @@ -954,6 +973,18 @@
954 973 return false;
955 974 }
956 975  
  976 + //2017/03/05 NAM ADD START
  977 + private bool IsMouseLeftClick(MouseEventArgs e)
  978 + {
  979 + if (e.LeftButton == MouseButtonState.Pressed)
  980 + {
  981 + return true;
  982 + }
  983 +
  984 + return false;
  985 + }
  986 + //2017/03/05 NAM ADD END
  987 +
957 988 /// <summary>
958 989 /// Draw curver line and yellow node
959 990 /// </summary>
960 991  
961 992  
962 993  
963 994  
... ... @@ -2133,26 +2164,29 @@
2133 2164  
2134 2165 if (i == gGrpBlueNode.Children.Count - 1)
2135 2166 {
2136   - // xoa line
  2167 + // delete line
2137 2168 if (gGrpNewLine.Children.Count > 0)
2138 2169 {
2139 2170 gGrpNewLine.Children.RemoveAt(i - 1);
2140 2171 }
2141 2172  
2142   - // xoa ucNode
  2173 + // delete ucNode
2143 2174 ucNode _ucNode = new ucNode();
2144 2175 _ucNode = ucNode_Lst[i];
2145 2176 this.Children.Remove(_ucNode);
2146 2177 ucNode_Lst.RemoveAt(i);
2147 2178  
2148   - // xoa node
  2179 + // delete node
2149 2180 gGrpBlueNode.Children.RemoveAt(i);
  2181 + NewNodeInfo_List.RemoveAt(i);
2150 2182  
2151 2183 }
2152 2184 else
2153 2185 {
2154 2186 // remove last Node
2155 2187 int lastIdx = gGrpBlueNode.Children.Count - 1;
  2188 +
  2189 + NewNodeInfo_List.RemoveAt(lastIdx);
2156 2190 gGrpBlueNode.Children.RemoveAt(lastIdx);
2157 2191 gGrpNewLine.Children.RemoveAt(lastIdx - 1);
2158 2192  
2159 2193  
... ... @@ -2187,8 +2221,11 @@
2187 2221 }
2188 2222  
2189 2223  
2190   -
2191 2224  
  2225 + //NewInitNodeInfo_List();
  2226 +
  2227 +
  2228 + NewDspRouteInfo();
2192 2229 stt--;
2193 2230  
2194 2231  
... ... @@ -2336,7 +2373,7 @@
2336 2373 }
2337 2374  
2338 2375  
2339   - private void CreateNode(Point FreeNode, bool RightClick)
  2376 + private void CreateNode(Point FreeNode, bool LeftClick, bool RightClick)
2340 2377 {
2341 2378 double radiusNode = RADIUS_NODE;
2342 2379  
2343 2380  
2344 2381  
... ... @@ -2390,19 +2427,23 @@
2390 2427 else
2391 2428 {
2392 2429 //Check EditNode State
2393   - for (int i = 0; i < gGrpBlueNode.Children.Count; i++)
2394   - {
2395   - ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i];
2396   - node = ellipseGeometry.Center;
2397   - bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE);
2398   -
2399   - if (isEditNode)
  2430 + if(LeftClick)
  2431 + {
  2432 + for (int i = 0; i < gGrpBlueNode.Children.Count; i++)
2400 2433 {
2401   - NewEditNode(node);
2402   - NewDspRouteInfo();
2403   - return;
  2434 + ellipseGeometry = (EllipseGeometry)gGrpBlueNode.Children[i];
  2435 + node = ellipseGeometry.Center;
  2436 + bool isEditNode = CheckIsNode(FreeNode, node, RADIUS_NODE);
  2437 +
  2438 + if (isEditNode)
  2439 + {
  2440 + NewEditNode(node);
  2441 + NewDspRouteInfo();
  2442 + return;
  2443 + }
2404 2444 }
2405 2445 }
  2446 +
2406 2447  
2407 2448 // them nut
2408 2449 MessageBoxResult result = MessageBox.Show("Do You Want To Add This Node?", "Add Node", MessageBoxButton.OKCancel);