/// <summary> /// Constructeur /// </summary> /// <param name="urlBuilder"></param> public CartService(IUrlBuilder urlBuilder) { baseApiUrl = urlBuilder.BaseUrl; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "dXNlcjpwYXNzdw =="); accountService = new AccountService(urlBuilder); routingService = new RoutingService(); }
public IHttpActionResult Get(int distritoId, int baseId, [FromUri] int[] transportistaId) { var ordersList = RoutingService.GetOrders(distritoId, baseId, transportistaId) .Select(e => Mapper.EntityToModel(e, new OrderModel())).ToList(); return(Ok(ordersList)); }
public IHttpActionResult Post(int distritoId, int baseId, [FromBody] OrderSelectionModel orderSelectionModel) { var routeCode = BuildRouteCode(orderSelectionModel.StartDateTime, orderSelectionModel.IdVehicle, orderSelectionModel.IdVehicleType, orderSelectionModel.LogisticsCycleType, distritoId, baseId); // Agrupo por OrderId var odByOrderId = orderSelectionModel.OrderDetailList.Where(od => od.Cuaderna != 0).GroupBy(od => od.OrderId); // foreach (var group in odByOrderId) { var order = EntityDao.FindById(group.Key); group.ToList().ForEach(od => { // Se asigna el ajuste y la cuaderna asignada var orderDetail = order.OrderDetails.Single(item => item.Id == od.Id); orderDetail.Ajuste = od.Ajuste; orderDetail.Cuaderna = od.Cuaderna; orderDetail.Estado = OrderDetail.Estados.Ruteado; }); // Programo por Orden RoutingService.Programming(order, routeCode, orderSelectionModel.IdVehicle, orderSelectionModel.StartDateTime, orderSelectionModel.LogisticsCycleType, orderSelectionModel.IdVehicleType); } return(Ok()); }
public static async Task <IEnhancedOrgService> GetSelfBalancingService(ServiceParams parameters, IReadOnlyCollection <IServicePool <IOrganizationService> > pools, RouterRules rules = null) { parameters.Require(nameof(parameters)); pools.Require(nameof(pools)); if (AutoSetMaxPerformanceParams) { parameters.AutoSetMaxPerformanceParams(); } var routingService = new RoutingService <IOrganizationService>(); foreach (var pool in pools) { routingService.AddNode(pool); } if (rules != null) { routingService.DefineRules(rules); } await routingService.StartRouter(); var routingPool = new RoutingPool <IOrganizationService>(routingService); return(new EnhancedServiceFactory <IEnhancedOrgService, Services.Enhanced.EnhancedOrgService>(parameters) .CreateService(routingPool)); }
public void setUp() { cargoRepository = MockRepository.GenerateMock <CargoRepository>(); locationRepository = MockRepository.GenerateMock <LocationRepository>(); routingService = MockRepository.GenerateMock <RoutingService>(); trackingIdFactory = MockRepository.GenerateMock <TrackingIdFactory>(); bookingService = new BookingServiceImpl(routingService, trackingIdFactory, cargoRepository, locationRepository); }
public IHttpActionResult Get(int distritoId, int baseId, int transportistaId, int orderId) { var orderDetails = RoutingService.GetOrderDetails(orderId) .Where(o => o.Estado == OrderDetail.Estados.Pendiente) .Select(e => MapperDetail.EntityToModel(e, new OrderDetailModel())); return(Ok(orderDetails.ToList())); }
public IActionResult Index() { RoutingService routingService = new RoutingService(); routingService.Route(CreateEnterpriseData()); return(View()); }
public void setUp() { cargoRepository = MockRepository.GenerateMock<CargoRepository>(); locationRepository = MockRepository.GenerateMock<LocationRepository>(); routingService = MockRepository.GenerateMock<RoutingService>(); trackingIdFactory = MockRepository.GenerateMock<TrackingIdFactory>(); bookingService = new BookingServiceImpl(routingService, trackingIdFactory, cargoRepository, locationRepository); }
private static void SetupRoutes() { // two built-in cases/handlers RoutingService.MapRoute(ABOUT_BLANK, new NavigationContentHandler((p) => new Themes.AboutBlank())); RoutingService.MapRoute(ABOUT_ERROR, new NavigationContentHandler((p) => new Themes.AboutError())); // this listens to any new elements being registered Resource <IRouteHandler> .Catalog.CollectionChanged += Route_CollectionChanged; }
public void UnregisteredModuleKeyLeadsToErrorOnGet() { Mock <IModuleSelector> moduleSelector = new Mock <IModuleSelector>(MockBehavior.Strict); moduleSelector.Setup(ms => ms.SelectModule("unregistered_module_key")).Returns((IModule)null); RoutingService sut = new RoutingService(moduleSelector.Object); Assert.Throws <ModuleNotRegisteredException>(() => sut.Get("some_query", "unregistered_module_key")); }
public IHttpActionResult Get(int id, [FromUri] int[] insumos) { var orderDetails = RoutingService.GetOrderDetails(id) .Where(o => o.Estado == OrderDetail.Estados.Pendiente) .WhereIf(insumos.Length > 0, od => insumos.Contains(od.Insumo.Id)) .Select(e => MapperDetail.EntityToModel(e, new OrderDetailModel())); return(Ok(orderDetails.ToList())); }
public BookingServiceImpl(RoutingService routingService, TrackingIdFactory trackingIdFactory, CargoRepository cargoRepository, LocationRepository locationRepository) { _routingService = routingService; _trackingIdFactory = trackingIdFactory; _cargoRepository = cargoRepository; _locationRepository = locationRepository; }
public void GetZoneId_positionNull_Expected_exception() { // Arrange. var options = GetFakeConstant(100); RoutingService service = new RoutingService(options); Vector2D position = null; // Act, Assert. Assert.Throws <ArgumentNullException>(() => service.GetZoneId(position)); }
public RoutingServiceTests() { _interactiveMessageServiceMock = new Mock <IInteractiveMessageService>(); _submissionSelectServiceMock = new Mock <ISubmissionSelectService>(); _slackExecutorServiceMock = new Mock <ISlackExecutorService>(); _slackHttpClientMock = new Mock <ISlackHttpClient>(); var logger = new Mock <ILogger <RoutingService> >(); _service = new RoutingService(_interactiveMessageServiceMock.Object, _submissionSelectServiceMock.Object, _slackExecutorServiceMock.Object, _slackHttpClientMock.Object, logger.Object); }
public void UnsupportedCategoryCauseException() { // arrange var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act Func <Task> act = async() => await routingService.GetEmailToSendTo(ValidPostcode, Category.None).ConfigureAwait(false); // assert act.Should().Throw <InvalidEnumArgumentException>(); }
/// <summary> /// Initializes a new instance of the <see cref="MvcServer"/> class. /// </summary> public MvcServer() { _current = this; Add(this); _viewEngines = new ViewEngineCollection(); // register built in actions _actions.Register(_actionProvider); RoutingService = new RoutingService(); }
public async Task ForDirectCategoriesReturnsCorrrectEmail(Category selectedCategory, string expectedEmail) { // arrange var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act var result = await routingService.GetEmailToSendTo(ValidPostcode, selectedCategory).ConfigureAwait(false); // assert A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).MustNotHaveHappened(); result.Should().Be(expectedEmail); }
public void ModuleIsInvokedOnGet() { Mock <IModuleSelector> moduleSelector = new Mock <IModuleSelector>(MockBehavior.Strict); Mock <IModule> module = new Mock <IModule>(MockBehavior.Loose); moduleSelector.Setup(ms => ms.SelectModule("some_module_key")).Returns(module.Object); RoutingService sut = new RoutingService(moduleSelector.Object); sut.Get("some_query", "some_module_key"); module.Verify(m => m.Get("some_query")); }
public void GetZoneId_size100_xMinus100_yMinus100_Expected_zone_Minus1_Minus1() { // Arrange. var options = GetFakeConstant(100); RoutingService service = new RoutingService(options); Vector2D position = new Vector2D(-100, -100); // Act. string resultZoneId = service.GetZoneId(position); // Assert. Assert.Equal("zone_-1_-1", resultZoneId); }
public void GetZoneId_size100_x1_y1_Expected_zone_0_0() { // Arrange. var options = GetFakeConstant(100); RoutingService service = new RoutingService(options); Vector2D position = new Vector2D(1, 1); // Act. string resultZoneId = service.GetZoneId(position); // Assert. Assert.Equal("zone_0_0", resultZoneId); }
public static ISelfBalancingOrgService GetSelfBalancingService(IEnumerable <EnhancedServiceParams> nodeParameters, RouterRules rules) { var routingService = new RoutingService(); foreach (var parameters in nodeParameters) { routingService.AddNode(parameters); } routingService.DefineRules(rules); routingService.StartRouter(); return(new EnhancedServiceFactory <ISelfBalancingOrgService, SelfBalancingOrgService>(routingService).CreateEnhancedService()); }
public void SetUp() { _loggerMock = new Mock <ILogger <RoutingService> >(MockBehavior.Strict); _loggerScopeMock = new Mock <IDisposable>(MockBehavior.Strict); _pipelineMock = new Mock <IPipeline>(MockBehavior.Strict); _pipelinesServiceMock = new Mock <IPipelinesService>(MockBehavior.Strict); _eventsScopeMock = new Mock <IEventsScope>(MockBehavior.Strict); _routingService = new RoutingService( _loggerMock.Object, _pipelinesServiceMock.Object ); _pipelineEvent = new PipelineEvent(new object()); }
public void ItShouldBePossibleToHandleUrlWithParameterSetValueOnly() { IRoutingHandler rs = new RoutingService(); rs.LoadControllers(new[] { typeof(MockController) }); rs.MapRoute("", "~/{controller}/Fuffa/{id}", new { Controller = "Mock", Action = "Index", Id = RoutingParameter.Optional }); var ctx = CreateRequest("http://127.0.0.1/Mock/Fuffa"); var result = rs.Resolve(ctx.Request.Url.LocalPath, ctx); Assert.IsNotNull(result); Assert.AreEqual(2, result.Parameters.Count); Assert.IsTrue(result.Parameters.ContainsKey("controller")); Assert.AreEqual("Mock", result.Parameters["controller"]); Assert.IsTrue(result.Parameters.ContainsKey("action")); Assert.AreEqual("Index", result.Parameters["action"]); }
public static void Resolve(ControllerActionRequest actionRequest, Action <ControllerContext> responseCallback) { Guard.ArgumentNotNull(actionRequest, "request"); Guard.ArgumentNotNull(responseCallback, "responseCallback"); // NOTE_: if the response is a action context response, we send that else we wrap it in a action // context response this is done because the api expects this.. RoutingService.Resolve(actionRequest, (r) => { if (typeof(ControllerContext).IsAssignableFrom(r.GetType())) { responseCallback((ControllerContext)r); } else { responseCallback(new ControllerContext(r)); } }); }
public async Task ForAdviceAndCoursesGetsEmailFromFam(Category selectedCategory) { // arrange var routingDetailModel = new RoutingDetailModel() { EmailAddress = "areaEmail", }; A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).Returns(routingDetailModel); var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act var result = await routingService.GetEmailToSendTo(ValidPostcode, selectedCategory).ConfigureAwait(false); // assert A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).MustHaveHappenedOnceExactly(); result.Should().Be(routingDetailModel.EmailAddress); }
public async Task WhenFamFailsToReturnEmailDefaultsToTheFallBack() { // arrange var routingDetailModel = new RoutingDetailModel() { EmailAddress = null, }; A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).Returns(routingDetailModel); var routingService = new RoutingService(FamApiRoutingOptions, fakeApiDataProcessorService, fakeHttpClient); // act var result = await routingService.GetEmailToSendTo(ValidPostcode, Category.AdviceGuidance).ConfigureAwait(false); // assert A.CallTo(() => fakeApiDataProcessorService.GetAsync <RoutingDetailModel>(A <HttpClient> .Ignored, A <Uri> .Ignored)).MustHaveHappenedOnceExactly(); result.Should().Be(FamApiRoutingOptions.FallbackEmailToAddresses); }
public async Task UploadFilesAsync(UploadFilesCommand command) { // Check file metadata against upload session information Guid sessionId = new Guid(command.UploadSessionId); UploadSession session = await this.UploadSessionRepository.GetByIdAsync(sessionId); if (session == null) { //TODO: Throw exception: the specified upload session does not exist. throw new UploadSessionNotStartedException("No upload session has been started. Please, make sure to first start the upload session before uploading files."); } if (!session.IsStarted) { throw new UploadSessionNotStartedException("The specified upload session is not in the started state so no files can be uploaded. Please, start a new session for uploading."); } // Check that id's specified in the command are valid if (!session.AreFilesRegistered(command.Files.Select(f => new Guid(f.FileId)).AsEnumerable())) { throw new UploadSessionFileNotRegisteredException("Some of the files specified were not previously registered for upload. Please, make sure that all files are first registered for upload at session start."); } // Upload files (first store file content, second update session information) foreach (var file in command.Files) { Guid fileId = new Guid(file.FileId); FileUploadDescription uploadDescription = session.GetFileUploadDescription(fileId); // Upload file ResourceUri sourceStoreFileUri = await this.UploadFileWithoutCommitingDomainChangesAsync(fileId, session.OwnerId, uploadDescription.FileName, uploadDescription.ContentType, uploadDescription.ContentLength, file.Content, session.UploadAsPublic); // Update session (mark file as uploaded and assign access uri) ResourceUri fileAccessUri = RoutingService.BuildUriForFile(uploadDescription, sourceStoreFileUri, session.UploadAsPublic); session.MarkFileAsUploaded(fileId); session.AssignUriToFileDescription(fileId, fileAccessUri); } // Save changes await this.unitOfWork.CommitChangesAsync(); }
public static void Resolve(NavigationRequest navigationRequest, Action <NavigationResponse> responseCallback) { Guard.ArgumentNotNull(navigationRequest, "navigationRequest"); Guard.ArgumentNotNull(responseCallback, "responseCallback"); // NOTE_: if the response is a navigation response, we send that else we wrap it in a navigation response // this is done because the api expects this.. we need this though, because if an error occurs we will // get back UrlResponse not NavigationResponse.. so.. RoutingService.Resolve(navigationRequest, (r) => { if (typeof(NavigationResponse).IsAssignableFrom(r.GetType())) { responseCallback((NavigationResponse)r); } else { responseCallback(new NavigationResponse(r)); } }); }
/// <summary> /// Process a request. /// </summary> /// <param name="context">Request information</param> /// <returns>What to do next.</returns> public ProcessingResult Process(RequestContext context) { _current = this; var routingContext = new RoutingContext(context.Request); var routeResult = RoutingService.Route(routingContext); if (routeResult == null) { return(ProcessingResult.Continue); } var controllerContext = new ControllerContext(context) { ActionName = routeResult.ActionName, ControllerUri = routeResult.ControllerUri }; var result = _factory.Invoke(routeResult.ControllerType, routeResult.Action, controllerContext); var viewData = result as IViewData; if (viewData != null) { _logger.Trace("Rendering action " + controllerContext.ActionName); RenderView(controllerContext, viewData); } else { var action = result as IActionResult; if (action != null) { ProcessingResult processingResult = _actionProvider.Invoke(context, action); if (processingResult == ProcessingResult.Abort) { return(processingResult); } } } return(ProcessingResult.SendResponse); }
static void Main(string[] args) { var service = new RoutingService(); var route = new Route() { UpstreamHost = "localhost", UpstreamPort = 8889, DownstreamHost = "speed.hetzner.de", DownstreamPort = 443, DownstreamIsTls = true }; service.AddRoute(route); var route2 = new Route() { UpstreamHost = "localhost", UpstreamPort = 9000, DownstreamHost = "localhost", DownstreamPort = 8889, }; service.AddRoute(route2); var route3 = new Route() { UpstreamHost = "localhost", UpstreamPort = 9001, DownstreamHost = "localhost", DownstreamPort = 9000, }; service.AddRoute(route3); new WebClient().DownloadFile("http://localhost:9001/100MB.bin", "test.bin"); Console.ReadKey(); }
public void ItShouldBePossibleToDistinguishTwoDifferentRequest() { IRoutingHandler rs = new RoutingService(); rs.LoadControllers(new[] { typeof(MockController) }); rs.MapRoute("", "~/{controller}/Index/{id}", new { Controller = "Mock", Action = "MethodIndex", Id = RoutingParameter.Optional }); rs.MapRoute("", "~/{controller}/Test/{id}", new { Controller = "Mock", Action = "MethodTest", Id = RoutingParameter.Optional }); var ctx = CreateRequest("http://127.0.0.1/Mock/Index"); var result = rs.Resolve(ctx.Request.Url.LocalPath, ctx); Assert.IsNotNull(result); Assert.AreEqual(2, result.Parameters.Count); Assert.IsTrue(result.Parameters.ContainsKey("controller")); Assert.AreEqual("Mock", result.Parameters["controller"]); Assert.IsTrue(result.Parameters.ContainsKey("action")); Assert.AreEqual("MethodIndex", result.Parameters["action"]); ctx = CreateRequest("http://127.0.0.1/Mock/Test"); result = rs.Resolve(ctx.Request.Url.LocalPath, ctx); Assert.IsNotNull(result); Assert.AreEqual(2, result.Parameters.Count); Assert.IsTrue(result.Parameters.ContainsKey("controller")); Assert.AreEqual("Mock", result.Parameters["controller"]); Assert.IsTrue(result.Parameters.ContainsKey("action")); Assert.AreEqual("MethodTest", result.Parameters["action"]); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /// Set online base layer var baseLayer = new NutiteqOnlineVectorTileLayer("nutibright-v2a.zip"); mapView.Layers.Add(baseLayer); // create PackageManager instance for dealing with offline packages var packageFolder = new File(GetExternalFilesDir(null), "routingpackages"); if (!(packageFolder.Mkdirs() || packageFolder.IsDirectory)) { Log.Fatal("Could not create package folder!"); } packageManager = new NutiteqPackageManager(ROUTING_PACKAGEMANAGER_SOURCE, packageFolder.AbsolutePath); packageManager.PackageManagerListener = new RoutingPackageListener(this); packageManager.Start(); // fetch list of available packages from server. Note that this is asynchronous operation and listener will be notified via onPackageListUpdated when this succeeds. packageManager.StartPackageListDownload(); // create offline routing service connected to package manager offlineRoutingService = new PackageManagerRoutingService(packageManager); // create additional online routing service that will be used when offline package is not yet downloaded or offline routing fails onlineRoutingService = new NutiteqOnlineRoutingService(ROUTING_SERVICE_SOURCE); // define layer and datasource for route line and instructions routeDataSource = new LocalVectorDataSource(baseProjection); VectorLayer routeLayer = new VectorLayer(routeDataSource); mapView.Layers.Add(routeLayer); // define layer and datasource for route start and stop markers routeStartStopDataSource = new LocalVectorDataSource(baseProjection); // Initialize a vector layer with the previous data source VectorLayer vectorLayer = new VectorLayer(routeStartStopDataSource); // Add the previous vector layer to the map mapView.Layers.Add(vectorLayer); // Set visible zoom range for the vector layer vectorLayer.VisibleZoomRange = new MapRange(0, 22); // set route listener RouteMapEventListener mapListener = new RouteMapEventListener(this); mapView.MapEventListener = mapListener; // create markers for start & end, and a layer for them MarkerStyleBuilder markerStyleBuilder = new MarkerStyleBuilder(); markerStyleBuilder.Bitmap = BitmapUtils .CreateBitmapFromAndroidBitmap(BitmapFactory.DecodeResource( Resources, Resource.Drawable.olmarker)); markerStyleBuilder.HideIfOverlapped = false; markerStyleBuilder.Size = 30; markerStyleBuilder.Color = new Nutiteq.Graphics.Color(Android.Graphics.Color.Green); startMarker = new Marker(new MapPos(0, 0), markerStyleBuilder.BuildStyle()); startMarker.Visible = false; markerStyleBuilder.Color = new Nutiteq.Graphics.Color(Android.Graphics.Color.Red); stopMarker = new Marker(new MapPos(0, 0), markerStyleBuilder.BuildStyle()); stopMarker.Visible = false; routeStartStopDataSource.Add(startMarker); routeStartStopDataSource.Add(stopMarker); markerStyleBuilder.Color = new Nutiteq.Graphics.Color(Android.Graphics.Color.White); markerStyleBuilder.Bitmap = BitmapUtils .CreateBitmapFromAndroidBitmap(BitmapFactory.DecodeResource( Resources, Resource.Drawable.direction_up)); instructionUp = markerStyleBuilder.BuildStyle(); markerStyleBuilder.Bitmap = BitmapUtils .CreateBitmapFromAndroidBitmap(BitmapFactory.DecodeResource( Resources, Resource.Drawable.direction_upthenleft)); instructionLeft = markerStyleBuilder.BuildStyle(); markerStyleBuilder.Bitmap = BitmapUtils .CreateBitmapFromAndroidBitmap(BitmapFactory.DecodeResource( Resources, Resource.Drawable.direction_upthenright)); instructionRight = markerStyleBuilder.BuildStyle(); // style for instruction balloons balloonPopupStyleBuilder = new BalloonPopupStyleBuilder(); balloonPopupStyleBuilder.TitleMargins = new BalloonPopupMargins(4, 4, 4, 4); // finally animate map to Estonia mapView.FocusPos = baseProjection.FromWgs84(new MapPos(25.662893, 58.919365)); mapView.Zoom = 7; Toast.MakeText(ApplicationContext, "Long-press on map to set route start and finish", ToastLength.Long).Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AddBaseLayer(CartoBaseMapStyle.CartoBasemapStyleDefault); // Create PackageManager instance for dealing with offline packages var packageFolder = new File(GetExternalFilesDir(null), "routingpackages"); if (!(packageFolder.Mkdirs() || packageFolder.IsDirectory)) { Log.Fatal("Could not create package folder!"); } packageManager = new CartoPackageManager(ManagerSource, packageFolder.AbsolutePath); PackageListener = new RoutingPackageListener(packageManager, downloadablePackages); packageManager.PackageManagerListener = PackageListener; packageManager.Start(); // Fetch list of available packages from server. // Note that this is asynchronous operation // and listener will be notified via onPackageListUpdated when this succeeds. packageManager.StartPackageListDownload(); // create offline routing service connected to package manager offlineRoutingService = new PackageManagerRoutingService(packageManager); // Create additional online routing service that will be used // when offline package is not yet downloaded or offline routing fails onlineRoutingService = new CartoOnlineRoutingService(ServiceSource); // Define layer and datasource for route line and instructions routeDataSource = new LocalVectorDataSource(BaseProjection); VectorLayer routeLayer = new VectorLayer(routeDataSource); MapView.Layers.Add(routeLayer); // Define layer and datasource for route start and stop markers routeStartStopDataSource = new LocalVectorDataSource(BaseProjection); // Initialize a vector layer with the previous data source VectorLayer vectorLayer = new VectorLayer(routeStartStopDataSource); // Add the previous vector layer to the map MapView.Layers.Add(vectorLayer); // Set visible zoom range for the vector layer vectorLayer.VisibleZoomRange = new MapRange(0, 22); // Set route listener MapListener = new RouteMapEventListener(); MapView.MapEventListener = MapListener; // Create markers for start & end and a layer for them MarkerStyleBuilder markerBuilder = new MarkerStyleBuilder(); markerBuilder.Bitmap = CreateBitmap(Resource.Drawable.olmarker); markerBuilder.HideIfOverlapped = false; markerBuilder.Size = 30; markerBuilder.Color = new Carto.Graphics.Color(Android.Graphics.Color.Green); startMarker = new Marker(new MapPos(0, 0), markerBuilder.BuildStyle()); startMarker.Visible = false; markerBuilder.Color = new Carto.Graphics.Color(Android.Graphics.Color.Red); stopMarker = new Marker(new MapPos(0, 0), markerBuilder.BuildStyle()); stopMarker.Visible = false; routeStartStopDataSource.Add(startMarker); routeStartStopDataSource.Add(stopMarker); markerBuilder.Color = new Carto.Graphics.Color(Android.Graphics.Color.White); markerBuilder.Bitmap = CreateBitmap(Resource.Drawable.direction_up); instructionUp = markerBuilder.BuildStyle(); markerBuilder.Bitmap = CreateBitmap(Resource.Drawable.direction_upthenleft); instructionLeft = markerBuilder.BuildStyle(); markerBuilder.Bitmap = CreateBitmap(Resource.Drawable.direction_upthenright); instructionRight = markerBuilder.BuildStyle(); // Style for instruction balloons balloonBuilder = new BalloonPopupStyleBuilder(); balloonBuilder.TitleMargins = new BalloonPopupMargins(4, 4, 4, 4); // Finally animate map to Estonia MapView.FocusPos = BaseProjection.FromWgs84(new MapPos(25.662893, 58.919365)); MapView.Zoom = 7; Alert("Long-press on map to set route start and finish"); }