0

I am using CAB and SCSF for my application and i am using CAB Extensibility Kit from Infragistics

I followed this article. The sample has three projects. Shell form . common and SmartPartLib

Infragistics CAB Extensibility Kit

in SmartPartLib project there is class ModuleController.cs. This method is creating some Views which are going to be displayed on App start... I want to know that when

this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace]

is Initialized. I tried to do the same in sample SCSF project but i am getting this WorkspaceObject as null.. Please tell me is anyone using Infragistics CAB Kit...

 private void AddViews()
        {
            //Create the Root View first, but do not show it
            RootView theRootView = this.WorkItem.SmartParts.AddNew<RootView>();


            //Here is the important part: 
            //Whenever dynamically creating controls that will interact with the
            //UltraDockManager, for the best results, make sure that you
            //assign a unique value to the control's "Name" property. In this case,
            //since the dynamic nature of CAB and SmartParts brings us to the
            //same situation, we also add a value to the SmartPart's "Name" property:

            TreeView theTreeView = this.WorkItem.SmartParts.AddNew<TreeView>();                 //1: Create
            theTreeView.Name = "theTreeView";                                                   //2: Set Name
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theTreeView); //3: Show it

            GridView theGridView = this.WorkItem.SmartParts.AddNew<GridView>();
            theGridView.Name = "theGridView";
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theGridView);

            ChartView theChartView = this.WorkItem.SmartParts.AddNew<ChartView>();
            theChartView.Name = "theChartView";
            this.WorkItem.Workspaces[Constants.WorkspaceNames.DockWorkspace].Show(theChartView);

            //Load the layout through the interface
            ((IRootView)theRootView).LoadDockLayout();

            //Finally show the Root View
            this.WorkItem.Workspaces[Constants.WorkspaceNames.MainWorkspace].Show(theRootView);

        }
Danko Valkov
  • 1,038
  • 8
  • 17
Mohsan
  • 2,483
  • 6
  • 47
  • 62

1 Answers1

0

You can try implementing the IBuilderAware interface and call your AddViews method from the OnBuiltUp method. This method will be called by CAB at a point after the Workspace collection is initialised.

Damian
  • 2,709
  • 2
  • 29
  • 40
  • Question is when the Workspace collection is initialized. In Sample provided by Microsoft they are registering workspace in ShellForm.cs class – Mohsan Jan 06 '11 at 05:33