SmartClient CAB SCSF

Jun 16, 2008 at 9:52 PM
Has anyone tried to make use of the Add-In Framework within the SmartClient?

Does it even make sense?
Sep 28, 2008 at 2:17 PM
Hi John,

I actually have the same question, did you manage to answer this ? Found any solution?

Thanks,
Dima
Sep 29, 2008 at 11:16 AM
Same question here too.

I actually tried to integrate the 2 but ran into problems with the ObjectBuilder dll. I have given up for the time being and am working with the System.AddIn to recreate the functionality I was using in the CAB. So far so good, but its not the easiest thing in the world to use. Only reason for doing it was because of an odd reflection "bug" in the ObjectBuilder which seemed to be loading the wrong dll, no matter what I tried!
Sep 29, 2008 at 12:25 PM

I have tried to load a MAF-add-in (which is also a CAB-module), into a MAF-host which is also a CAB-shell and tried to utilize existing feature of SCSF/CAB with MAF

 

You can have multiple Add-Ins loaded in different AppDomains as long as they don't have visuals and serializable object. Modules that have visual elements (UI controls, Shell, views, WorkItems etc.) need to run on a single AppDomain.

That is why I think it does not add up “Add-in Framework with CAB”

 

 

My approach was very simple.

I created a contract with a method that’s takes workitem as a parameter.

 

[AddInContract]

    public interface IContracts:IContract

    {

        void LoadMyModule(WorkItem RootWorkItem);

 }

 

From the Shell pass the RootWorkitem to the Add-in (this is a CAB module). Some modification in Module.cs

 

namespace CABHost.MyAddIn_1

{

    [AddIn("AddIn_1")]

    public class Module : ModuleInit, MyContract.AddInViews.IContracts

    {

        private WorkItem _rootWorkItem;

 

        [ServiceDependency]

        public WorkItem RootWorkItem

        {

            get

            {

                return _rootWorkItem;

            }

            set

            {

                _rootWorkItem = value;

            }

        }

 

        public override void Load()

        {

            base.Load();

 

            ControlledWorkItem<ModuleController> workItem = _rootWorkItem.WorkItems.AddNew<ControlledWorkItem<ModuleController>>();

            workItem.Controller.Run();

        }

 

        #region IContracts Members

 

        public void LoadMyModule(WorkItem RootWorkItem)

        {

            Microsoft.Practices.CompositeUI.Services.IModuleLoaderService moduleLoaderService;

            moduleLoaderService = RootWorkItem.Services.Get<Microsoft.Practices.CompositeUI.Services.IModuleLoaderService>();

            moduleLoaderService.Load(RootWorkItem, this.GetType().Assembly);

        }

 

        #endregion

    }

}

Sep 29, 2008 at 12:51 PM
That looks great, but, doesn't it restrict some of the functionality within the System.AddIn framework (isolation levels etc)? Did you get any benefit from this approach?