Question

Imagine I have a coroutine which uses the implementation of Loader included in the CM docs, and I use it to show a busy indicator on my page

Now imagine the user attempts to add an object which already exists to the data store - naturally during the coroutine the 'save' operation will fail, meaning the coroutine will cancel execution

If this happens, the enumerator never reaches my Loader.Hide() call to hide the busy indicator - I'm wondering if there is already a mechanism in place to allow some IResult implementations to execute even if the coroutine fails?

Example:

    public IEnumerator<IResult> SaveData()
    {
        yield return Framework.Coroutines.Loader.Show("Saving Data");
        yield return new Framework.Coroutines.SaveOperation(SomeObject);
        yield return Framework.Coroutines.Loader.Hide();
    }

If the coroutine fails legitimately on the second step, the busy indicator remains on screen, leaving the user no chance to correct their errors and attempt a re-save (and stopping any interaction with the underlying UI!)

I could just extend the implementation of coroutine and have iterators that have a flag which says whether they are allowed to execute when there is an error - just wondering if anyone has done this already or if it's a part of the framework I'm missing?

Was it helpful?

Solution

You could also use Caliburn.Micro Action Filters. See SetBusyAttribute. The declarative style of attributes is transparent and makes the code easier to manage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top