ActivateItem in Conductor<T> via Conductor<T>.Collection.OneActive

Nov 22, 2010 at 8:52 PM

Hi everybody,

Thanks for superb framework, i tried it and like it,

however there is problem i can't handle while exploring CM

I mean a diffrence between ActivateItem in Conductor<T> and Conductor<T>.Collection.OneActive

the first one   

        public override void ActivateItem(T item)
        {
            if (item != null && item.Equals(ActiveItem))
            {
                OnActivationProcessed(item, true);
                return;
            }

            CloseStrategy.Execute(new[] { ActiveItem }, (canClose, items) =>
            {
                if (canClose)
                    ChangeActiveItem(item, true);
                else OnActivationProcessed(item, false);
            });
        }

second
                public override void ActivateItem(T item)
                {
                    if (item != null && item.Equals(ActiveItem))
                    {
                        OnActivationProcessed(item, true);
                        return;
                    }

                    ChangeActiveItem(item, false);
                }

The problem is when Activating one item but ActiveItem shouldn't be close(deactivated) because of dirty data
it looks like it is supported only in first class ...?!
     

 

Coordinator
Nov 22, 2010 at 10:01 PM

When you activate an item in Conductor<T>.Collection.OneActive it does not close the previous active item. You have to call CloseItem on it to do that. Have a read through of the docs on Screens and Conductors. There is an explanation of this difference.

Nov 24, 2010 at 4:03 PM

thanks for answer, I've read the doc on Screen and Conductors again, and let me comment it.

so if you want to close active item and activate another item and then

- first you call CloseItem on ActiveItem (and to be sure that user agreed to close it, you check if this item is still active, if so, than you can call Dispose on that item  - is that correct?)

- second, you activate another item

If this scenerio is correct than we actually make ActiveItem twise, first when closing ActiveItem and then DetermineNextItemToActivate, second activating our desired item - this could be tricky, am I right?

 

 

Nov 24, 2010 at 4:06 PM

sorry, i correct the mistake ...

thanks for answer, I've read the doc on Screen and Conductors again, and let me comment it.

so if you want to close active item and activate another item then

- first you call CloseItem on ActiveItem (and to be sure that user agreed to close it, you check if this item is still active, if NOT, than you can call for example Dispose on that item  - is that correct?)

- second, you activate another item

If this scenerio is correct than we actually make ActiveItem twise, first when closing ActiveItem and then DetermineNextItemToActivate, second activating our desired item - this could be tricky, am I right?