2011-01-05 3 views
0

J'utilise CAB et SCSF pour mon application et j'utilise CAB Extensibilité Kit de InfragisticsCAB avec UltraDockWorkspace

J'ai suivi cet article. L'échantillon a trois projets. Forme de coquille. commun et SmartPartLib

Infragistics CAB Extensibility Kit

dans le projet SmartPartLib il y a ModuleController.cs de classe. Cette méthode crée des vues qui vont être affichées sur App début ... Je veux savoir que lorsque

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

est initialisés. J'ai essayé de faire la même chose dans le projet exemple SCSF mais je reçois ce WorkspaceObject comme nulle .. S'il vous plaît dites-moi est toute personne qui utilise 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); 

     } 

Répondre

0

Vous pouvez mettre en œuvre l'interface IBuilderAware et appelez vos AddViews méthode de la méthode OnBuiltUp. Cette méthode sera appelée par CAB à un moment après l'initialisation de la collection Workspace.

+0

La question se pose lorsque la collection Workspace est initialisée. Dans l'exemple fourni par Microsoft, ils enregistrent un espace de travail dans la classe ShellForm.cs – Mohsan