Conductor OneActive, Screen and two Deactivates

Topics: Bugs
Mar 8, 2012 at 2:59 PM

I'm getting two Deactivate as my application closes down for the currently active Screen.
Below code fragments show where.
Isn't it just sufficient to test for IsActive in Screen.cs?

thanks
John

ConductionWithCollectionOneActive.cs

                /// <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));
                        items.Clear(); ///HERE causing second Deactivate
                    }


Screen.cs
        void IDeactivate.Deactivate(bool close)
        {
            if (!IsActive && !IsInitialized)
            {
                return;
            }

//Isn't this sufficient??             if (!IsActive )             {                 return;             }
Mar 13, 2012 at 9:55 AM

Please can Rob and other Caliburn.Micro Gurus comment on this. Thanks
John

Coordinator
Mar 16, 2012 at 2:00 AM

Please create a ticket for this and attach a simple sample solution that demonstrates the issue. I'll look into it.

Mar 16, 2012 at 9:47 AM

I've created
http://caliburnmicro.codeplex.com/workitem/218
with example attached.

thanks
John