Exemplo n.º 1
0
        public IOverlay GetOverlay(string name, bool createIfNotExists = false)
        {
            IOverlay result = null;

            try
            {
                _context.Send(_ =>
                {
                    GMapOverlay overlay = _mapControl.Overlays.FirstOrDefault(i => i.Id == name);

                    if (overlay == null)
                    {
                        if (createIfNotExists)
                        {
                            AddOverlay(name);
                            result = GetOverlay(name);
                            return;
                        }

                        throw new ArgumentException($"Overlay {name} not found.");
                    }

                    result = new OverlayAdapter(overlay);
                }, null);
            }
            catch (Exception ex)
            {
            }

            return(result);
        }
Exemplo n.º 2
0
        public IOverlay GetOverlay(string name, bool createIfNotExists = false)
        {
            IOverlay result = null;
            _context.Send(_ =>
            {
                GMapOverlay overlay = _mapControl.Overlays.FirstOrDefault(i => i.Id == name);

                if (overlay == null)
                {
                    if (createIfNotExists)
                    {
                        AddOverlay(name);
                        result = GetOverlay(name);
                        return;
                    }

                    throw new ArgumentException($"Overlay {name} not found.");
                }

                result = new OverlayAdapter(overlay);
            }, null);

            return result;
        }