Пример #1
0
 /// <summary>
 ///     create route objuct for Green Route
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _btnGreen_Click(object sender, EventArgs e)
 {
     if (SubmitRoute != null)
     {
         IRouteInfo routeInfo = _env.TrackModel.requestRouteInfo(1);
         IBlock endBlock = _env.TrackModel.requestBlockInfo(routeInfo.EndBlock, routeInfo.RouteName);
         IRoute r = new Route(RouteTypes.DefinedRoute, endBlock, routeInfo.RouteID, routeInfo.BlockList.ToList());
         SubmitRoute(this, new RoutingToolEventArgs(r,null));
     }
 }
Пример #2
0
        /// <summary>
        ///     handle response send by ctc gui with end block
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _ctcGui_RoutingToolResponse(object sender, RoutingToolEventArgs e)
        {
            if (e.Block != null)
            {
                _endBlock = e.Block;

                if (SubmitRoute != null)
                {
                    //TODO - populate list of block inbetween current and dest
                    string line;
                    if (_startBlock.Line.CompareTo("Red") == 0)
                    {
                        line = "Red";
                    }
                    else
                    {
                        line = "Green";
                    }

                    IBlock[] b = _env.TrackModel.requestPath(_startBlock.BlockID, _endBlock.BlockID, line);
                    List<IBlock> routeBlocks = b.ToList<IBlock>();
                    IRoute r = new Route(RouteTypes.PointRoute, _endBlock, -1, routeBlocks);
                    SubmitRoute(this, new RoutingToolEventArgs(r,null));
                }
            }
        }