Lazy loading - where to trigger automatic download

Aug 5, 2010 at 8:37 AM
Edited Aug 5, 2010 at 8:53 AM


Still playing around with Caliburn.Micro SL with the SimpleContainer recipe and added the LazyTaskBarItem from NavigationShell sample. It works well when triggering it from a button after the application is completely loaded. I was wondering what your advice were in this thread Where is the first possible place to automatically call to download an assembly? For example if the R&D department distributes a "standard" application and the "project" wants to do addons or register lazy "modules" in the container. So my idea is that "standard" could try to load an project configuration assembly by naming convention. Does it make any sense?


EDIT - When I'm thinking about it I would be really nice to have a some kind of

        public virtual IEnumerable<IResult> ConfigureApplication()
            // var loginResult = Login(...
            // var projectSetting = new ProjectConfiguration
            //Get project specific configuration assembly
            //Get use settings etz
            // yield Show.Child<IApplication>().In<IShell>()
            yield break;

that is automatically called when it's possible. Or if not automatically where could I put something like this?

Aug 5, 2010 at 1:52 PM

Well, you could put this in your ShellViewModel as an action that is wired to execute based on the ShellView.Loaded event. Or you could add it to the ShellViewModel as a method and manually use the result enumerator to execute it when the VM is activated. Wold any of those ideas work?

Aug 5, 2010 at 2:21 PM

I tested with this in my ShellView.xaml

cal:Message.Attach="[Event Loaded] = Action[TestBusy]"

works nice. I also wanted to try the other approach but I can't find the extension method Execute in Caliburn.Micro?

Aug 5, 2010 at 2:22 PM

The extension method doesn't exist in Micro, you would have to create the enumerator and call it yourself. If you're happy with using the Loaded event, I would stick with that.