Example #1
0
 public void HandleTransmitterLocationEvent(BleTransmitter transmitter)
 {
     WPFMethodInvoker.InvokeAsync(() =>
     {
         FrameworkElement transmitterElement;
         if (!_transmitterPositions.TryGetValue(transmitter.MacAddress, out transmitterElement))
         {
             return;
         }
         transmitterElement.Opacity = 1;
         transmitterElement.Visibility = Visibility.Hidden;
         var position = new PointF(transmitter.Position.X + transmitter.VisualOffset, transmitter.Position.Y + transmitter.VisualOffset - 1);
         SetElementPosition(transmitterElement, position);
         transmitterElement.Visibility = Visibility.Visible;
     });
 }
Example #2
0
        private void AddTransmitter( BleTransmitter bleTransmitter)
        {
            var grid = new Grid
            {
                RenderTransform = new ScaleTransform(0.1, 0.1),
                Style = (Style)this.Resources["AnimateTransmitterStyle"],
                Visibility = Visibility.Hidden,
                ToolTip = bleTransmitter.TransmitterName

            };

            var manPath1 = new Path
            {
                Data =
                    Geometry.Parse(
                        "m256.062225,124.192871c14.424774,0 26.085876,-11.200264 26.085876,-25.129318c0,-13.842712 -11.661102,-25.103043 -26.085876,-25.103043c-14.335449,0 -25.996521,11.26033 -25.996521,25.103043c0.003906,13.929054 11.665009,25.129318 25.996521,25.129318z"),
                Fill =new SolidColorBrush(bleTransmitter.ColorCode.ToMediaColor())
            };
            var manPath2 = new Path
            {
                Data =
                    Geometry.Parse(
                        "m220.869019,367.93457c0,7.79895 6.436981,14.104919 14.514008,14.104919c8.04599,0 14.608002,-6.305969 14.608002,-14.104919l0,-118.204041l12.235992,0l0,118.204041c0,7.79895 6.561005,14.104919 14.608002,14.104919c8.076996,0 14.544983,-6.305969 14.544983,-14.104919l0.08902,-203.801056l12.147003,0l0,75.128998c0,15.130005 20.375977,15.130005 20.375977,0l0,-76.77002c0,-16.68396 -13.453003,-32.988983 -33.677002,-32.988983l-68.994995,-0.085999c-18.494995,0 -33.312012,14.545013 -33.312012,32.610016l0,77.237976c0,14.95401 20.496002,14.95401 20.496002,0l0,-75.131989l12.361023,0l0,203.801056l0.003998,0z"),
                Fill = new SolidColorBrush(bleTransmitter.ColorCode.ToMediaColor())
            };

            grid.Children.Add(manPath1);
            grid.Children.Add(manPath2);
            _transmitterPositions.Add(bleTransmitter.MacAddress, grid);
            MapCanvas.Children.Add(grid);
            //var humanAverageSize = MetricToLocal(new SizeF(0.5f, 1.8f));
            //var shape = new RectangleShape
            //{
            //    Width = humanAverageSize.Width,
            //    Height = humanAverageSize.Height,
            //    Stroke = new SolidColorBrush(bleTransmitter.ColorCode.ToMediaColor()),
            //    StrokeThickness = 4,
            //    Fill = Brushes.DimGray,
            //    Style = (Style)this.Resources["AnimateTransmitterStyle"],
            //    Visibility = Visibility.Hidden

            //};
            //_transmitterPositions.Add(bleTransmitter.TransmitterName,shape);
            //MapCanvas.Children.Add(shape);
        }