AvalonDock and Caliburn.Micro

Topics: Conventions
Mar 1, 2012 at 10:20 PM

Hi,
I'm sure you've all noticed that there is v2 of AvalonDock soon to be released, with MVVM support.
I thought I'd create both the Custom Convention (CC) and the AttachedProperty approaches to integrating with Caliburn.Micro.
(Attached Property approach, see http://www.felicepollano.com/Trackback.aspx?guid=9dcc8717-eb83-45b5-ac89-2f0d0cf05bde)

I've got one bug in the CC solution (the solution follows the same approach as Caliburn.Micro.Telerik, and has the same test program)
The bug is when the application closes - I get two calls to the OnDeactivate to the ViewModel (which is a tab) that is active. And in some cases causes the application to crash.

I can't find it, and can't think of a way to look for it.
Any suggestion?
Anybody want it with a view to fixing it?

thanks
John

Mar 2, 2012 at 2:37 PM

Found out a bit more from the CM code - WPF version
In  public class OneActive : ConductorBaseWithActiveItem<T>
when the application is shutting down

 

                /// <summary>
                /// Called when deactivating.
                /// </summary>
                /// <param name="close">Inidicates whether this instance will be closed.</param>
                protected override void OnDeactivate(bool close) 
                {
                    if (close) 
                    {
                        items.OfType<IDeactivate>().Apply(x => x.Deactivate(true)); //HERE fires all the Item's OnDeactivated
                        items.Clear();  //HERE. But here I get an extra OnDeactived for the one that was active
                    }
                    else {
                        ScreenExtensions.TryDeactivate(ActiveItem, false);
                    }
                }

 puzzled
John