コード例 #1
0
ファイル: MapUIManager.cs プロジェクト: cabird/GPS-Simulator
        public void DrawWayPoints()
        {
            ClearWayPoints();
            foreach (var loc in route)
            {
                var pin = new Pushpin();
                pin.Location   = loc;
                pin.MouseDown += Pin_MouseDown;
                pin.MouseUp   += Pin_MouseUp;
                pins.Add(pin);

                // draw the tack on map
                Color pinColor = loc == route.First() ? startColor : loc == route.Last() ? endColor : routeColor;
                pin.Background = new SolidColorBrush(pinColor);
                map.Children.Add(pin);
            }

            // draw the line of the route
            polyline                 = new MapPolyline();
            polyline.Locations       = snappedRoute ?? route;
            polyline.Stroke          = new System.Windows.Media.SolidColorBrush(routeColor);
            polyline.StrokeThickness = 3;
            polyline.Opacity         = 0.7;

            map.Children.Add(polyline);
        }
コード例 #2
0
        public void DrawPolygon(LocationCollection locations, string msg)
        {
            currentLine = new List <UIElement>();
            Location lastLocation = locations.Last();

            _tag = Common_liby.GetGuidString();

            poly                 = new MapPolygon();
            poly.Locations       = locations;
            poly.StrokeThickness = 2;
            poly.Opacity         = 0.5;
            poly.Stroke          = new SolidColorBrush(Colors.Red);
            poly.Fill            = new SolidColorBrush(Color.FromArgb(200, 253, 128, 68));
            poly.StrokeLineJoin  = PenLineJoin.Round;
            lyr.Children.Add(poly);
            currentLine.Add(poly);

            foreach (Location location in locations)
            {
                AddToMapLayer(CreatePoint(), location, PositionOrigin.Center);
            }

            movePanel = CreatePanel(msg, "");
            AddToMapLayer(movePanel, lastLocation);

            var del = CreateDeleteButton();

            lyr.AddChild(del, lastLocation, new System.Windows.Point(-13, 6));
            currentLine.Add(del);
            dicLines.Add(_tag, currentLine);
        }
コード例 #3
0
        public async Task Run_KnownLocationRequested_ReturnsHintAsToAvailability(string locName)
        {
            var request  = ExpectedRequests.CapacityFor(locName);
            var capacity = new Random().Next(0, 100);
            var used     = new Random().Next(0, 100);

            _knownLocations.Last().Capacity = capacity;
            _capacityService.ReturnsThis = used;

            var response = await _sut.Execute(request, _logger).AsSlackResponse();

            Assert.That(response.text, Is.EqualTo($"There are {used} of {capacity} desks used in {locName}."));
            Assert.That(response.attachments.Single().image_url, Is.Not.Null);
        }