コード例 #1
0
ファイル: Robot.cs プロジェクト: SlamCake/LegoRobot
 public void PassRoute(Route route)
 {
     foreach (var action in serializer.Serialize(route)) {
         server.Invoke(() => Send(action));
         server.Invoke(CheckAnswerIsOk);
     }
     Db.RoutePassed(route);
 }
コード例 #2
0
ファイル: Db.cs プロジェクト: SlamCake/LegoRobot
        public static void FillDbWithFakeRoute()
        {
            var route = new Route {Scale = 10};

            var points = new List<Point> {
                new Point(0, 2),
                new Point(1, 3),
                new Point(4, 3),
                new Point(4, 6),
                new Point(2, 8),
                new Point(0, 8),
                new Point(0, 10)
            };

            Context.Routes.Add(route);
            Context.Starts.Add(new Start {Position = new Point(0, 0), Offset = new Point(1, 1)});

            for (var i = 0; i < points.Count; i++) {
                Context.Points.Add(points[i]);
                Context.PointRoutes.Add(new PointRoutes {Index = i, Point = points[i], Route = route});
            }

            Context.SaveChanges();
        }
コード例 #3
0
ファイル: Db.cs プロジェクト: SlamCake/LegoRobot
 public static void RoutePassed(Route route)
 {
     Invoke(() => Context.Log.Add(new Log {Route = route, Time = DateTime.Now, Succeed = true}));
     Invoke(() => Context.SaveChanges());
 }