Index: Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs =================================================================== diff -u -r96605c3f9beab21e2739081492bac131d0978d7a -r97b8c68c7a4da08b4d969a0cababbbc50b4b4408 --- Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision 96605c3f9beab21e2739081492bac131d0978d7a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision 97b8c68c7a4da08b4d969a0cababbbc50b4b4408) @@ -52,11 +52,6 @@ activated = true; } - private void GuiOnActiveViewChanged(object sender, ActiveViewChangeEventArgs e) - { - - } - public override void Dispose() { if (activated) @@ -79,5 +74,27 @@ GetViewName = (v, o) => Resources.DotSpatialGuiPlugin_GetViewInfoObjects_Map }; } + + private void GuiOnActiveViewChanged(object sender, ActiveViewChangeEventArgs activeViewChangeEventArgs) + { + UpdateComponentsForActiveView(); + } + + /// + /// Updates the components which the knows about so that it reflects + /// the currently active view. + /// + private void UpdateComponentsForActiveView() + { + var mapView = Gui.ActiveView as IMapView; + if (mapView != null) + { + mapRibbon.Map = mapView.Map; + } + else + { + mapRibbon.Map = null; + } + } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml =================================================================== diff -u -r96605c3f9beab21e2739081492bac131d0978d7a -r97b8c68c7a4da08b4d969a0cababbbc50b4b4408 --- Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml (.../MapRibbon.xaml) (revision 96605c3f9beab21e2739081492bac131d0978d7a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml (.../MapRibbon.xaml) (revision 97b8c68c7a4da08b4d969a0cababbbc50b4b4408) @@ -5,20 +5,13 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:fluent="clr-namespace:Fluent;assembly=Fluent" xmlns:p="clr-namespace:Core.Plugins.DotSpatial.Properties" - xmlns:common="clr-namespace:Core.Common.Gui.Properties;assembly=Core.Common.Gui" mc:Ignorable="d" Width="686.4" Height="168" Background="White"> - - - - - - Index: Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs =================================================================== diff -u -r96605c3f9beab21e2739081492bac131d0978d7a -r97b8c68c7a4da08b4d969a0cababbbc50b4b4408 --- Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs (.../MapRibbon.xaml.cs) (revision 96605c3f9beab21e2739081492bac131d0978d7a) +++ Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs (.../MapRibbon.xaml.cs) (revision 97b8c68c7a4da08b4d969a0cababbbc50b4b4408) @@ -24,6 +24,7 @@ using System.Windows; using Core.Common.Controls.Commands; using Core.Common.Gui.Forms; +using Core.Components.DotSpatial; using Fluent; namespace Core.Plugins.DotSpatial @@ -33,21 +34,39 @@ /// public partial class MapRibbon : IRibbonCommandHandler { + private IMap map; + public MapRibbon() { InitializeComponent(); } - public ICommand ToggleLegendViewCommand { private get; set; } + public IMap Map + { + private get + { + return map; + } + set + { + map = value; + if (map != null) + { + ShowMapTab(); + } + else + { + HideMapTab(); + } + } + } + public IEnumerable Commands { get { - if (ToggleLegendViewCommand != null) - { - yield return ToggleLegendViewCommand; - } + yield break; } } @@ -56,23 +75,25 @@ return RibbonControl; } - public void ValidateItems() - { - - } + public void ValidateItems() {} public bool IsContextualTabVisible(string tabGroupName, string tabName) { // TODO: Required only because this method is called each time ValidateItems is called in MainWindow // Once ValidateItems isn't responsible for showing/hiding contextual tabs, then this method can return false, // but more ideally be removed. - // return MapContextualGroup.Name == tabGroupName && MapContextualGroup.Visibility == Visibility.Visible; - return true; + return MapContextualGroup.Name == tabGroupName && MapContextualGroup.Visibility == Visibility.Visible; } - private void ButtonToggleLegend_Click(object sender, RoutedEventArgs e) + private void ShowMapTab() { - throw new NotImplementedException(); + MapContextualGroup.Visibility = Visibility.Visible; + ValidateItems(); } + + private void HideMapTab() + { + MapContextualGroup.Visibility = Visibility.Collapsed; + } } } \ No newline at end of file