I am writing a system tray utility and from the menu there are several different forms that you can open for the application. I am using autofac to resolve the creation of these forms when necessary giving my main form Func and Func dependencies.
If the user selects an option that activates the form, if it is already shown it should receive focus, otherwise autofac should create a new form.
I don't really want these forms sitting in memory while they aren't in use, so I am currently letting the form Dispose of itself when the user closes it.
What I need to know is how I can notify autofac that the form has been disposed so that:
I've been reading the Autofac wiki and I'm guessing that I just need to set the LifetimeScope properly.