private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton radioButton = (RadioButton)sender;

            if (radioButton.Checked)
            {
                Overlay currentOverlay = (Overlay)radioButton.Tag;
                OverlayChangedOverlaySwitcherEventArgs overlaySwitchedEventArgs = new OverlayChangedOverlaySwitcherEventArgs((Overlay)radioButton.Tag);
                OnOverlaySwitched(overlaySwitchedEventArgs);

                if (overlaySwitchedEventArgs.Cancel)
                {
                    radioButton.Checked = false;
                    foreach (RadioButton item in Controls.OfType <RadioButton>())
                    {
                        Overlay tempOverlay = item.Tag as Overlay;
                        if (tempOverlay != null && tempOverlay.IsVisible)
                        {
                            item.Checked = true;
                            break;
                        }
                    }
                }
                else
                {
                    foreach (Overlay overlay in Overlays)
                    {
                        overlay.IsVisible = currentOverlay == overlay;
                    }
                    mapControl.Refresh();
                }
            }
        }
 protected virtual void OnOverlayChanged(OverlayChangedOverlaySwitcherEventArgs e)
 {
     EventHandler<OverlayChangedOverlaySwitcherEventArgs> handler = OverlayChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        private void OverlaySwitcherOverlayChanged(object sender, OverlayChangedOverlaySwitcherEventArgs e)
        {
            BingMapsOverlay bingMapsOverlay = e.Overlay as BingMapsOverlay;

            if (bingMapsOverlay != null)
            {
                e.Cancel = ApplyBingMapsKey();
            }
        }
Exemple #4
0
        protected virtual void OnOverlayChanged(OverlayChangedOverlaySwitcherEventArgs e)
        {
            EventHandler <OverlayChangedOverlaySwitcherEventArgs> handler = OverlayChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemple #5
0
 private void ChangeBaseOverlay(OverlayItem item)
 {
     if (IsLoaded)
     {
         OverlayChangedOverlaySwitcherEventArgs overlaySwitchedEventArgs = new OverlayChangedOverlaySwitcherEventArgs(item.Overlay);
         OnOverlayChanged(overlaySwitchedEventArgs);
         if (overlaySwitchedEventArgs.Cancel)
         {
             BindingOverlays(CurrentMap.Overlays.FirstOrDefault(o => o.IsBase && o.IsVisible));
         }
         else
         {
             foreach (Overlay overlay in CurrentMap.Overlays.Where(o => o.IsBase))
             {
                 overlay.IsVisible = item.Overlay == overlay;
             }
             CurrentMap.Refresh();
         }
     }
 }
 private void OverlaySwitcherOverlayChanged(object sender, OverlayChangedOverlaySwitcherEventArgs e)
 {
     BingMapsOverlay bingMapsOverlay = e.Overlay as BingMapsOverlay;
     if (bingMapsOverlay != null)
     {
         e.Cancel = ApplyBingMapsKey();
     }
 }
 private void ChangeBaseOverlay(OverlayItem item)
 {
     if (IsLoaded)
     {
         OverlayChangedOverlaySwitcherEventArgs overlaySwitchedEventArgs = new OverlayChangedOverlaySwitcherEventArgs(item.Overlay);
         OnOverlayChanged(overlaySwitchedEventArgs);
         if (overlaySwitchedEventArgs.Cancel)
         {
             BindingOverlays(CurrentMap.Overlays.FirstOrDefault(o => o.IsBase && o.IsVisible));
         }
         else
         {
             foreach (Overlay overlay in CurrentMap.Overlays.Where(o => o.IsBase))
             {
                 overlay.IsVisible = item.Overlay == overlay;
             }
             CurrentMap.Refresh();
         }
     }
 }