Inheritance: Caliburn.Micro.Screen, IPopupScreen
Example #1
0
 private void s_PingReceived(Service s, BaseContent b)
 {
     var wm = new WebMercator();
     var pos = (MapPoint)wm.FromGeographic(new MapPoint(b.Position.Longitude, b.Position.Latitude));
     var pcov = new PingCallOutViewModel { Ping = b };
     var callOut = new MapCallOutViewModel
     {
         Width = 250,
         TimeOut = new TimeSpan(0, 0, 0, 5),
         CanClose = false,
         ForegroundBrush = Brushes.White,
         BackgroundBrush = Brushes.Red,
         ViewModel = pcov,
         Point = pos
     };
     AppState.Popups.Add(callOut);
     //AppState.TriggerNotification();
     AppState.ViewDef.ZoomAndPoint(new Point(b.Position.Longitude, b.Position.Latitude));
 }
Example #2
0
        public void OpenPopup(MapPoint tapPos, TapMode tm)
        {
            var pc = new PoiCallOutViewModel { Poi = Poi };

            callOut = new MapCallOutViewModel
            {
                Width = Poi.NEffectiveStyle.CallOutMaxWidth.HasValue ? Poi.NEffectiveStyle.CallOutMaxWidth.Value : 350,
                Title = Poi.Name,
                TimeOut = new TimeSpan(0, 0, 0, Poi.NEffectiveStyle.CallOutTimeOut.Value),
                CanClose = true,
                CanPin = Poi.NEffectiveStyle.AddMode != AddModes.OpenAfter,
                ForegroundBrush = new SolidColorBrush(Poi.NEffectiveStyle.CallOutForeground.Value),
                BackgroundBrush = new SolidColorBrush(Poi.NEffectiveStyle.CallOutFillColor.Value),
                ViewModel = pc,
                Point = (Geometry is MapPoint) ? (MapPoint)Geometry : tapPos,
                Graphic = this,
                Orientation = (CallOutOrientation) Enum.Parse(typeof(CallOutOrientation), Poi.NEffectiveStyle.CallOutOrientation.Value.ToString())
            };
            pc.CallOut = callOut;

            callOut.Tapped += (s, f) =>
            {
                if (tm != TapMode.CallOutPopup || GroupLayer == null) return;
                if (!callOut.Pinned) callOut.Close();
                //GroupLayer.OpenPoiPopup(Poi);
            };
            callOut.Closed += (s, f) => { callOutVisible = false; };

            UpdateCalloutActions();
            if (callOut.Orientation == CallOutOrientation.RightSideMenu)
            {
                // Close all open popups
                for (var i = AppState.Popups.Count-1; i>= 0; i--)
                {
                    var co = AppState.Popups[i] as MapCallOutViewModel;
                    if (co == null) continue;
                    co.Close();
                }
            }
            AppState.Popups.Add(callOut);
            if (tm == TapMode.CallOutEdit) callOut.StartEditing();
            callOutVisible = true;
        }