Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs =================================================================== diff -u -ra805f816afeba48586bf812cd9869ad215b5d9c2 -r8f6918ebceb1e084bc543203ecf5bdf4cae2e925 --- Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs (.../ViewList.cs) (revision a805f816afeba48586bf812cd9869ad215b5d9c2) +++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs (.../ViewList.cs) (revision 8f6918ebceb1e084bc543203ecf5bdf4cae2e925) @@ -337,11 +337,6 @@ } FireActiveViewChangedEvent(oldView); - - if (Gui != null && Gui.Plugins != null) - { - Gui.Plugins.ForEach(p => p.OnActiveViewChanged(view)); - } } /// Index: Core/Common/src/Core.Common.Gui/GuiPlugin.cs =================================================================== diff -u -ra805f816afeba48586bf812cd9869ad215b5d9c2 -r8f6918ebceb1e084bc543203ecf5bdf4cae2e925 --- Core/Common/src/Core.Common.Gui/GuiPlugin.cs (.../GuiPlugin.cs) (revision a805f816afeba48586bf812cd9869ad215b5d9c2) +++ Core/Common/src/Core.Common.Gui/GuiPlugin.cs (.../GuiPlugin.cs) (revision 8f6918ebceb1e084bc543203ecf5bdf4cae2e925) @@ -80,7 +80,5 @@ { Gui = null; } - - public virtual void OnActiveViewChanged(IView view) { } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs =================================================================== diff -u -rfb6f952991193be2c30995f3f8e60312c12dc052 -r8f6918ebceb1e084bc543203ecf5bdf4cae2e925 --- Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision fb6f952991193be2c30995f3f8e60312c12dc052) +++ Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision 8f6918ebceb1e084bc543203ecf5bdf4cae2e925) @@ -121,12 +121,16 @@ Gui.Application.ProjectClosing += ApplicationProjectClosing; Gui.Application.ProjectOpening += ApplicationProjectOpening; + if (Gui != null && Gui.DocumentViews != null) { if (Gui.DocumentViews.ActiveView != null) { - OnActiveViewChanged(Gui.DocumentViews.ActiveView); + DocumentViewsActiveViewChanged(); } + + Gui.DocumentViews.ActiveViewChanging += DocumentViewsActiveViewChanging; + Gui.DocumentViews.ActiveViewChanged += DocumentViewsActiveViewChanged; Gui.DocumentViews.ChildViewChanged += DocumentViewsOnChildViewChanged; Gui.DocumentViews.CollectionChanged += ViewsCollectionChanged; } @@ -150,6 +154,13 @@ { if (Gui.DocumentViews != null) { + if (Gui.DocumentViews.ActiveView != null) + { + DocumentViewsActiveViewChanging(); + } + + Gui.DocumentViews.ActiveViewChanging -= DocumentViewsActiveViewChanging; + Gui.DocumentViews.ActiveViewChanged -= DocumentViewsActiveViewChanged; Gui.DocumentViews.ChildViewChanged -= DocumentViewsOnChildViewChanged; Gui.DocumentViews.CollectionChanged -= ViewsCollectionChanged; } @@ -180,15 +191,30 @@ base.Deactivate(); } - public override void OnActiveViewChanged(IView view) + private void DocumentViewsActiveViewChanged(object sender, ActiveViewChangeEventArgs e) { - Unsubscribe(); + DocumentViewsActiveViewChanged(); + } + private void DocumentViewsActiveViewChanged() + { Subscribe(); UpdateChartLegendView(); } + private void DocumentViewsActiveViewChanging(object sender, ActiveViewChangeEventArgs e) + { + DocumentViewsActiveViewChanging(); + } + + private void DocumentViewsActiveViewChanging() + { + Unsubscribe(); + + UpdateChartLegendView(); + } + private void ViewsCollectionChanged(object sender, NotifyCollectionChangingEventArgs e) { if (Gui == null || Gui.DocumentViews == null) @@ -247,7 +273,7 @@ private void DocumentViewsOnChildViewChanged(object sender, NotifyCollectionChangingEventArgs notifyCollectionChangingEventArgs) { - OnActiveViewChanged(notifyCollectionChangingEventArgs.Item as IView); + DocumentViewsActiveViewChanged(); } private void UpdateChartLegendView()