Beispiel #1
0
        private async void BindDataControls()
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High,
                                                                                                        () =>
            {
                TB_NDevices.Text = string.Format(CultureInfo.InvariantCulture, "{0:### ### ###}", Twins.Count).Trim();
            });

            CTRL_NewDevices.BaseNDevices = Twins.Count;
            CTRL_Telemetry.BaseNDevices  = Twins.Count;
            CTRL_Bulk.BaseNDevices       = Twins.Count;

            foreach (var twin in Twins)
            {
                CTRL_Bulk.AddDeviceButNoListings(twin.DeviceID, twin.DeviceID, GeoPositionConversor.Parse(twin.DevicePosition));
            }

            CTRL_NewDevices.BindData();
            CTRL_Telemetry.BindData();
            CTRL_Bulk.BindData();
        }
Beispiel #2
0
        private async void AddMapElements_Projects(bool centerOnTarget)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
            {
                Coordinates     = new List <Windows.Devices.Geolocation.BasicGeoposition>();
                var zindex      = 1000;
                var strokeColor = ColorHandler.FromHex(Project.FillColor);
                var mapProjects = new List <MapElement>();

                Coordinates.AddRange(GeoPositionConversor.Parse(Project.Coordinates));

                var mapPolygon = new MapPolygon
                {
                    Tag             = Project.Name,
                    Path            = new Geopath(Coordinates),
                    ZIndex          = zindex,
                    FillColor       = FillColor,
                    StrokeColor     = strokeColor,
                    StrokeThickness = 3,
                    StrokeDashed    = false,
                };

                mapProjects.Add(mapPolygon);


                var mapProjectsLayer = new MapElementsLayer
                {
                    ZIndex      = zindex,
                    MapElements = mapProjects
                };

                MapLayers.Add(mapProjectsLayer);
                CTRL_Map_Main.Layers.Add(mapProjectsLayer);
            });

            if (centerOnTarget)
            {
                await CTRL_Map_Main.TrySetViewBoundsAsync(GeoboundingBox.TryCompute(Coordinates), new Thickness(200), MapAnimationKind.Bow);
            }
        }
Beispiel #3
0
        private async Task <bool> DrawPushpins(List <Twin> twins)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
            {
                var mapDevices = new List <MapElement>();

                foreach (var device in twins)
                {
                    var position = device.DevicePosition;

                    var pushpin = new MapIcon
                    {
                        Location = new Geopoint(GeoPositionConversor.Parse(position)),
                        NormalizedAnchorPoint = new Point(0.5, 1),
                        ZIndex = 0,
                        Tag    = "EXISTING",
                        Title  = device.DeviceID,
                        Image  = RandomAccessStreamReference.CreateFromUri(new Uri(resourceLoader.GetString("Map_Pushpin_Default")))
                    };

                    mapDevices.Add(pushpin);

                    //ExistingDeviceMapIcons.Add(pushpin);
                }

                var mapDevicesLayer = new MapElementsLayer
                {
                    ZIndex      = 1,
                    MapElements = mapDevices
                };

                MapLayers.Add(mapDevicesLayer);
                CTRL_Map_Main.Layers.Add(mapDevicesLayer);
            });

            return(true);
        }